On Tue, Mar 11, 2014 at 06:48:37PM +0800, Thomas Preud'homme wrote: > I also added a typedef unsigned uint32_t for when sizeof(unsigned) == 4. I > hope it's right.
In theory you could have __CHAR_BIT__ different from 8 and what you care about is that uint32_t has exactly 32 bits, so the check would need to be if (sizeof (uint32_t) * __CHAR_BIT__ != 32) return 0; > + if (fake_swap32 (0x12345678) != 0x78567E12) > + __builtin_abort (); Also, for int16 targets where __UINT32_TYPE__ is supposedly unsigned long, I think you would need to use: if (fake_swap32 (0x12345678UL) != 0x78567E12UL) __builtin_abort (); (the C standard guarantees that unsigned long is at least 32-bit and unsigned int at least 16-bit). Ok with those changes. Do you have write access, or will somebody from your coworkers commit it for you? Are you covered by ARM GCC Copyright assignment? Jakub