]>
git.zerfleddert.de Git - proxmark3-svn/blob - common/parity.h
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.
17 extern const uint8_t OddByteParity
[256];
20 static inline bool oddparity8(const uint8_t x
) {
21 return OddByteParity
[x
];
25 static inline bool evenparity8(const uint8_t x
) {
26 return !OddByteParity
[x
];
30 static inline bool evenparity32(uint32_t x
)
35 return evenparity8(x
);
37 return __builtin_parity(x
);
42 static inline bool oddparity32(uint32_t x
)
49 return !__builtin_parity(x
);
53 #endif /* __PARITY_H */