It's more of a learning thing really. I haven't had the chance to work on much performace critcal code, lately, but would like to. But just in general, it's a good idea to know the size/performance trade-offs of different C & C++ constructs, and the only way to know what's really going on is to look at the generated code.
I'm not getting what's going on in the first couple lines of assembly - where did the 33 comparison come from, and why would you want it? The enum goes up to 127, yet it's jumping past the switch statement if there are any input values above 33?
It must be that I'm not getting what _arg$[ esp-4 ] means, as it looks like it's reading an offset subsection of arg? Man, it must be too long since I've looked at assembly.
Good catch that 33 was a type-o. Originally I was working with an enum that went from 0,33. So that was basically checking if the value was greater then the last enum value then jumping to end.
As for the _arg$[ esp-4 ] thing, I'm a bit fuzzy with the .asm syntax myself, but I'm pretty sure it's reading 4 off the stack pointer, where the first argument is stored.
Comments 4
Reply
Reply
It must be that I'm not getting what _arg$[ esp-4 ] means, as it looks like it's reading an offset subsection of arg? Man, it must be too long since I've looked at assembly.
Reply
As for the _arg$[ esp-4 ] thing, I'm a bit fuzzy with the .asm syntax myself, but I'm pretty sure it's reading 4 off the stack pointer, where the first argument is stored.
Reply
Leave a comment