Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

Assembler optimisation - how to avoid a jump? (Developers)

posted by cm(R) Homepage E-mail, Düsseldorf, Germany, 13.05.2012, 23:32

> 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:

Back to the forum
Board view  Mix view
15239 Postings in 1372 Threads, 251 registered users, 14 users online (1 registered, 13 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum