Assembler optimisation - how to avoid a jump? (Developers)
> 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.
Hmm, I'm not very good at this. (Usually, I try to rather optimise for code size, and in pure 8086-compatible code.) But let me try.
> sub edx,ecx
> jnc @RLE_CLIP_MOVE_CONT
> 
> add ecx,edx
> 
> @RLE_CLIP_MOVE_CONT:
The following assumes that eax is available:
        sub edx, ecx
        rcr eax, 1
        sar eax, 31
        and eax, edx
        add ecx, eax
This does avoid the jump, but I don't know whether it is actually much better speed-wise.
---
l
Complete thread:
- Assembler optimalisation - how to avoid a jump? - Laaca, 13.05.2012, 20:38 ![Open in board view [Board]](img/board_d.gif) ![Open in mix view [Mix]](img/mix_d.gif) - 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
 Board view
Board view Mix view
Mix view

