Assembler optimalisation - how to avoid a jump? (Developers)
I write some kind of RLE sprite routine with clipping.
I would like to write nice code. I know I could somehow remove the ugly jump "jnc @RLE_CLIP_MOVE_CONT" but I don't know how.
In EDX is length of displayable scanline (computed by clipping routine)
In ECX is number of pixels which could be copyied. It is always>0
After clipping I sometimes can't copy all ECX bytes but only EDX bytes.
That it what this code does.
@RLE_CLIP_MOVE:
sub edx,ecx
jnc @RLE_CLIP_MOVE_CONT
add ecx,edx
@RLE_CLIP_MOVE_CONT:
shr ecx,1;rep movsd;adc ecx,ecx;rep movsw {fast 32bit write}
cmp edx,0
jle @RLE_CLIP_END_LOOP
jmp @RLE_CLIP_SCANLINE_LOOP
---
DOS-u-akbar!
Complete thread:
- Assembler optimalisation - how to avoid a jump? - Laaca, 13.05.2012, 20:38 (Developers)
- Assembler optimalisation - how to avoid a jump? - Rugxulo, 13.05.2012, 21:10
- Assembler optimalisation - how to avoid a jump? - Laaca, 13.05.2012, 22:15
- Assembler optimalisation - how to avoid a jump? - marcov, 13.05.2012, 23:22
- Assembler optimalisation - how to avoid a jump? - Laaca, 13.05.2012, 22:15
- Assembler optimisation - how to avoid a jump? - ecm, 13.05.2012, 23:32
- Assembler optimisation - how to avoid a jump? - Laaca, 14.05.2012, 18:15
- Assembler optimisation - variant 3, sbb - ecm, 14.05.2012, 18:22
- Assembler optimisation - how to avoid a jump? - Rugxulo, 16.05.2012, 10:34
- Assembler optimisation - how to avoid a jump? - bretjohn, 16.05.2012, 16:42
- Assembler optimisation - speed, size, etc - ecm, 16.05.2012, 16:59
- Assembler optimisation - how to avoid a jump? - bretjohn, 16.05.2012, 16:42
- Assembler optimisation - how to avoid a jump? - Laaca, 14.05.2012, 18:15
- Assembler optimalisation - how to avoid a jump? - Rugxulo, 13.05.2012, 21:10