flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 07 Nov 2004, 03:16
Code: macro inc v {add v,1} macro dec v {sub v,1} Of course, you need to make sure you do not need to preserve the carry flag! |
|||
![]() |
|
vid 07 Nov 2004, 19:31
someone could create optimization macros for particular processors
|
|||
![]() |
|
beppe85 07 Nov 2004, 23:51
It's not optimization if it alter meaning of an instruction. In the first case(revolution), you need to preserve CF. In the second(Matrix), you need to not preserve any but CF. Also, touching the stack may slow down things and disrupt programmer intention.
I think if there's a better way to do in some circunstances, you do not do it by macros. |
|||
![]() |
|
revolution 08 Nov 2004, 01:51
Beppe85: Yeah, I already mentioned about the carry, but I find very rarely do I actually need to preserve the CF.
Matrix: using add and sub are faster on the P4 because it modifies all the flags, but inc/dec preserve CF. So in the P4 inc/dec stall until the flags are updated. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.