Well, the program compiled and ran with expected numbers on my Windows machine. This means that it is either a data alignment issue or a size of variable problem. Much research needs to be done.
EDIT: I wrote a short program to dump out the size of all data types used by the structures and found that on the Windows box an unsigned long is 4 bytes, and on the Mac it's 8 bytes. That explains the problem but now I'm not sure what to do. Can I just alter the struct (swap unsigned long for unsigned int) and hope for the best?
I would rewrite your code using macros:
ReplyDelete#ifdef I_AM_A_HIP_MAC
typedef uint32_t (unsigned int)
typedef uint64_t (unsigned long)
#endif
#ifdef I_AM_A_BORING_PC
typedef uint32_t (unsigned int)
typedef uint64_t (unsigned long long)
#endif
All your structures can import this "types.h" file and now the data members will be disambigu-afied (uint32_t is always 32 bits == 4 bytes). That's how most folks write platform independent code.