12#ifndef ZEPHYR_INCLUDE_SYS_MATH_EXTRAS_H_
13#error "please include <sys/math_extras.h> instead of this file"
25#ifdef PORTABLE_MISC_MATH_EXTRAS
26#define use_builtin(x) 0
28#define use_builtin(x) HAS_BUILTIN(x)
31#if use_builtin(__builtin_add_overflow)
34 return __builtin_add_overflow(a, b,
result);
39 return __builtin_add_overflow(a, b,
result);
44 return __builtin_add_overflow(a, b,
result);
49 return __builtin_add_overflow(a, b,
result);
89#if use_builtin(__builtin_mul_overflow)
92 return __builtin_mul_overflow(a, b,
result);
97 return __builtin_mul_overflow(a, b,
result);
102 return __builtin_mul_overflow(a, b,
result);
107 return __builtin_mul_overflow(a, b,
result);
116 return a != 0 && (
c / a) != b;
125 return a != 0 && (
c / a) != b;
134 return a != 0 && (
c / a) != b;
143 return a != 0 && (
c / a) != b;
187#if use_builtin(__builtin_clz)
190 return x == 0 ? 32 : __builtin_clz(x);
197 for (b = 0; b < 32 && (x >> 31) == 0; b++) {
205#if use_builtin(__builtin_clzll)
208 return x == 0 ? 64 : __builtin_clzll(x);
221#if use_builtin(__builtin_ctz)
224 return x == 0 ? 32 : __builtin_ctz(x);
231 for (b = 0; b < 32 && (x & 1) == 0; b++) {
239#if use_builtin(__builtin_ctzll)
242 return x == 0 ? 64 : __builtin_ctzll(x);
char c
Definition: printk.c:71
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT64_TYPE__ uint64_t
Definition: stdint.h:61
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59