1 //-----------------------------------------------------------------------------
2 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
3 // at your option, any later version. See the LICENSE.txt file for the text of
5 //-----------------------------------------------------------------------------
7 //-----------------------------------------------------------------------------
9 // all functions defined in header file by purpose. Allows compiler optimizations.
16 extern const uint8_t OddByteParity
[256];
18 static inline uint8_t oddparity8(const uint8_t x
) {
19 return OddByteParity
[x
];
22 static inline uint8_t evenparity8(const uint8_t x
) {
23 return !OddByteParity
[x
];
26 static inline uint8_t evenparity32(uint32_t x
) {
30 return evenparity8(x
);
32 return (__builtin_parity(x
) & 0xFF);
36 static inline uint8_t oddparity32(uint32_t x
) {
42 return !__builtin_parity(x
);
46 #endif /* __PARITY_H */