Optimization shouldn't affect it unless there is undefined behavior happening. Looking at the code generated by the preprocessor would probably be helpful to see what is actually generated by the macros. It looks like an array indexed by generated enums, and it's possible there is something weird happening with that generation in the 64-bit case causing the indexing to be incorrect. I'd worry that this isn't the only place it is happening, just one where it is immediately obvious something is wrong.
I had thought that it was possible that int and int32 might be different sizes in 64-bit, but unless I'm missing a different typedef there's no guarantee that int32 is 32 bits at all, it is just an unsigned int that can be 64-bits and still be standard compliant. Both are 32-bits in Visual Studio but I thought gcc might make them 64-bits. For things that require specific sizes int32_t or uint32_t would be a better choice, but that would make the code not compile on Visual Studio 2008 without some extra work since it doesn't have the header for C99 types or support the latest standard.
|