3 ms·
You can shrink it further by doing xorl reg, reg. On x86, the upper 32 bits are cleared for you when using 32 bit opcodes. No need to do a 64-bit reg, reg xor.
by fear91 3y ago
You can shrink it further by doing xorl reg, reg. On x86, the upper 32 bits are cleared for you when using 32 bit opcodes. No need to do a 64-bit reg, reg xor.
Instead of doing cmp $0, %eax, you can use test eax, eax - that's another low hanging fruit.
It seems that you could also preset a dedicated reg to 0 and another to 1, further shaving a few bytes.
- meribold 3y agoThanks for the suggestions! I'll definitely look into those. I'd been hoping posting on HN would result in being able to shave off yet a few more bytes.
- userbinator 3y agoAlso learn the string instructions --- I can see plenty of places where a lodsb would help greatly.