comparison dvdread/bswap.h @ 316:e60fce5af518 src

in B2N_64 always append ULL to the hex bitmasks to force conversion of the expression to 64 bit and prevent overflow; patch by VLC team
author nicodvb
date Tue, 04 Dec 2007 23:03:58 +0000
parents 19fc7a620f4f
children
comparison
equal deleted inserted replaced
315:9abc06e356ff 316:e60fce5af518
79 x = ((((x) & 0xff000000) >> 24) | \ 79 x = ((((x) & 0xff000000) >> 24) | \
80 (((x) & 0x00ff0000) >> 8) | \ 80 (((x) & 0x00ff0000) >> 8) | \
81 (((x) & 0x0000ff00) << 8) | \ 81 (((x) & 0x0000ff00) << 8) | \
82 (((x) & 0x000000ff) << 24)) 82 (((x) & 0x000000ff) << 24))
83 #define B2N_64(x) \ 83 #define B2N_64(x) \
84 x = ((((x) & 0xff00000000000000) >> 56) | \ 84 x = ((((x) & 0xff00000000000000ULL) >> 56) | \
85 (((x) & 0x00ff000000000000) >> 40) | \ 85 (((x) & 0x00ff000000000000ULL) >> 40) | \
86 (((x) & 0x0000ff0000000000) >> 24) | \ 86 (((x) & 0x0000ff0000000000ULL) >> 24) | \
87 (((x) & 0x000000ff00000000) >> 8) | \ 87 (((x) & 0x000000ff00000000ULL) >> 8) | \
88 (((x) & 0x00000000ff000000) << 8) | \ 88 (((x) & 0x00000000ff000000ULL) << 8) | \
89 (((x) & 0x0000000000ff0000) << 24) | \ 89 (((x) & 0x0000000000ff0000ULL) << 24) | \
90 (((x) & 0x000000000000ff00) << 40) | \ 90 (((x) & 0x000000000000ff00ULL) << 40) | \
91 (((x) & 0x00000000000000ff) << 56)) 91 (((x) & 0x00000000000000ffULL) << 56))
92 92
93 #else 93 #else
94 94
95 /* If there isn't a header provided with your system with this functionality 95 /* If there isn't a header provided with your system with this functionality
96 * add the relevant || define( ) to the portable implementation above. 96 * add the relevant || define( ) to the portable implementation above.