Re: fast bit rotation
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jan 01, 2004
- 443 views
Tommy wrote: <snip> > Perhaps my machine-code version (which BTW only works on > Intel-compatible microprocessors) I think Euphoria itself "only" runs on Intel-compatible processors, no? > could even be tweaked a little further: > does anybody know if it's OK to replace PUSHA/POPA with PUSH EAX/POP EAX, > if I only modify EAX? I think it would definitely be faster. AFAIK it's not necessary to preserve the registers EAX, ECX and EDX. When you look at the demo program 'callmach.ex' (Euphoria 2.4), you'll see in Example #2, that RDS also uses EAX without preserving it. Your code only uses EAX, so I think it's not necessary to preserve any register at all. To try it out, just replace #60 and #61 with #90 (NOP) in your code. It works fine for me. BTW, Rob: Is there a typo in 'callmach.ex' Example #2, or do I misunderstand something? Concerning add_code(), it reads in the comment: "12 (4+8) (hex C) bytes are popped off the stack before returning", but the statement that you use is: "#C2, #08, #00 -- ret 8 -- pop 8 bytes off the stack" Regards, Juergen -- /"\ ASCII ribbon campain | This message has been ROT-13 encrypted \ / against HTML in | twice for higher security. X e-mail and news, | / \ and unneeded MIME | http://home.arcor.de/luethje/prog/