ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libecb/ecb.h
(Generate patch)

Comparing libecb/ecb.h (file contents):
Revision 1.75 by root, Wed Jan 25 19:57:49 2012 UTC vs.
Revision 1.76 by root, Wed Jan 25 20:23:12 2012 UTC

393#endif 393#endif
394 394
395/* try to tell the compiler that some condition is definitely true */ 395/* try to tell the compiler that some condition is definitely true */
396#define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0) 396#define ecb_assume(cond) do { if (!(cond)) ecb_unreachable (); } while (0)
397 397
398ecb_function_ unsigned char ecb_byteorder_helper (void) ecb_const; 398ecb_inline unsigned char ecb_byteorder_helper (void) ecb_const;
399ecb_function_ unsigned char 399ecb_inline unsigned char
400ecb_byteorder_helper (void) 400ecb_byteorder_helper (void)
401{ 401{
402 const uint32_t u = 0x11223344; 402 const uint32_t u = 0x11223344;
403 return *(unsigned char *)&u; 403 return *(unsigned char *)&u;
404} 404}
405 405
406ecb_function_ ecb_bool ecb_big_endian (void) ecb_const; 406ecb_inline ecb_bool ecb_big_endian (void) ecb_const;
407ecb_function_ ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; } 407ecb_inline ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; }
408ecb_function_ ecb_bool ecb_little_endian (void) ecb_const; 408ecb_inline ecb_bool ecb_little_endian (void) ecb_const;
409ecb_function_ ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; } 409ecb_inline ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; }
410 410
411#if ECB_GCC_VERSION(3,0) || ECB_C99 411#if ECB_GCC_VERSION(3,0) || ECB_C99
412 #define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0)) 412 #define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0))
413#else 413#else
414 #define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n))) 414 #define ecb_mod(m,n) ((m) < 0 ? ((n) - 1 - ((-1 - (m)) % (n))) : ((m) % (n)))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines