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
> add ecx,edx

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.



Complete thread:

Back to the forum
Board view  Mix view
15317 Postings in 1383 Threads, 254 registered users, 17 users online (0 registered, 17 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum