Hacker News new | past | comments | ask | show | jobs | submit login

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.




Thanks 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.


Also learn the string instructions --- I can see plenty of places where a lodsb would help greatly.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: