123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354 |
- extern "C" {
- (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h))))
- ZERO_OR_COMPILE_ERROR( \
- !__builtin_types_compatible_p(__typeof__(array), \
- __typeof__(&(array)[0])))
- ((long) (IS_ARRAY(array) + (sizeof(array) / sizeof((array)[0]))))
- ((ptr) && ((ptr) >= &array[0] && (ptr) < &array[ARRAY_SIZE(array)]))
- ((type *)(((char *)(ptr)) - offsetof(type, field)))
- (((unsigned long)(x) + ((unsigned long)(align) - 1)) & \
- ~((unsigned long)(align) - 1))
- ((unsigned long)(x) & ~((unsigned long)(align) - 1))
- (((numerator) + ((divider) - 1)) / (divider))
- static inline bool is_power_of_two(unsigned int x)
- {
- return (x != 0U) && ((x & (x - 1U)) == 0U);
- }
- static inline int64_t arithmetic_shift_right(int64_t value, uint8_t shift)
- {
- int64_t sign_ext;
- if (shift == 0U) {
- return value;
- }
-
- sign_ext = (value >> 63) & 1;
-
- sign_ext = -sign_ext;
-
- return (value >> shift) | (sign_ext << (64 - shift));
- }
- static inline void bytecpy(void *dst, const void *src, size_t size)
- {
- size_t i;
- for (i = 0; i < size; ++i) {
- ((uint8_t *)dst)[i] = ((uint8_t *)src)[i];
- }
- }
- int char2hex(char c, uint8_t *x);
- int hex2char(uint8_t x, char *c);
- size_t bin2hex(const uint8_t *buf, size_t buflen, char *hex, size_t hexlen);
- size_t hex2bin(const char *hex, size_t hexlen, uint8_t *buf, size_t buflen);
- static inline uint8_t bcd2bin(uint8_t bcd)
- {
- return ((10 * (bcd >> 4)) + (bcd & 0x0F));
- }
- static inline uint8_t bin2bcd(uint8_t bin)
- {
- return (((bin / 10) << 4) | (bin % 10));
- }
- uint8_t u8_to_dec(char *buf, uint8_t buflen, uint8_t value);
- }
|