| | Due to a horrible file i/o system I have to use at work (reads in a file and returns an array of bytes), I needed to write a conversion scheme for making these bytes into ints and back again. I'll post it up here for you guys. Note: this only handles the PC's little endian-ness. uint32 GetInt32( uint8 *pBytes ) { return (uint32)(*(pBytes + 3) << 24 | *(pBytes + 2) << 16 | *(pBytes + 1) << 8 | *pBytes); } void Int32ToUInt8Arr( int32 val, uint8 *pBytes ) { pBytes[0] = (uint8)val; pBytes[1] = (uint8)(val >> 8); pBytes[2] = (uint8)(val >> 16); pBytes[3] = (uint8)(val >> 24); } |

