Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
4.1.99
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
Zephyr API Documentation
►
Introduction
Deprecated List
►
Topics
►
Data Structures
▼
Files
▼
File List
►
doc
►
kernel
►
lib
►
subsys
▼
zephyr
►
acpi
►
app_memory
►
arch
►
audio
►
bluetooth
►
canbus
►
console
►
crypto
►
data
►
debug
►
devicetree
►
dfu
►
display
►
drivers
►
dsp
►
dt-bindings
►
fs
►
input
►
internal
►
ipc
►
kernel
►
linker
►
llext
►
logging
►
lorawan
►
math
►
mctp
►
mem_mgmt
►
mgmt
►
misc
►
modbus
►
modem
►
multi_heap
►
net
►
platform
►
pm
►
portability
►
posix
►
psa
►
random
►
retention
►
rtio
►
sd
►
sensing
►
settings
►
shell
►
sip_svc
►
stats
►
storage
▼
sys
►
internal
►
__assert.h
►
atomic.h
►
atomic_arch.h
►
atomic_builtin.h
►
atomic_c.h
►
atomic_types.h
►
barrier.h
barrier_builtin.h
►
base64.h
►
bitarray.h
►
byteorder.h
►
cbprintf.h
cbprintf_cxx.h
►
cbprintf_enums.h
►
cbprintf_internal.h
►
check.h
►
crc.h
►
device_mmio.h
►
dlist.h
errno_private.h
►
fdtable.h
►
hash_function.h
►
hash_map.h
►
hash_map_api.h
►
hash_map_cxx.h
►
hash_map_oa_lp.h
►
hash_map_sc.h
►
heap_listener.h
►
iterable_sections.h
►
kobject.h
►
libc-hooks.h
►
linear_range.h
list_gen.h
►
math_extras.h
►
math_extras_impl.h
►
mem_blocks.h
►
mem_manage.h
►
mem_stats.h
►
mpsc_lockfree.h
►
mpsc_packet.h
►
mpsc_pbuf.h
►
multi_heap.h
►
mutex.h
►
notify.h
►
onoff.h
►
p4wq.h
►
poweroff.h
►
printk-hooks.h
►
printk.h
►
rb.h
►
reboot.h
►
ring_buffer.h
►
sem.h
►
sflist.h
►
slist.h
►
speculation.h
►
spsc_lockfree.h
►
spsc_pbuf.h
►
sys_heap.h
►
sys_io.h
►
time_units.h
►
timeutil.h
►
util.h
►
util_internal.h
util_internal_is_eq.h
util_internal_util_dec.h
util_internal_util_inc.h
util_internal_util_x2.h
util_listify.h
util_loops.h
►
util_macro.h
►
winstream.h
►
task_wdt
►
timing
►
toolchain
►
tracing
►
usb
►
usb_c
►
xen
►
zbus
►
zvfs
►
bindesc.h
►
cache.h
►
device.h
►
devicetree.h
►
fatal.h
►
fatal_types.h
►
init.h
►
irq.h
►
irq_multilevel.h
►
irq_nextlevel.h
►
irq_offload.h
►
kernel.h
kernel_includes.h
►
kernel_structs.h
►
kernel_version.h
►
net_buf.h
►
shared_irq.h
►
smf.h
►
spinlock.h
►
sw_isr_table.h
►
sys_clock.h
►
syscall.h
►
toolchain.h
types.h
►
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
math_extras.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019 Facebook.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
19
#ifndef ZEPHYR_INCLUDE_SYS_MATH_EXTRAS_H_
20
#define ZEPHYR_INCLUDE_SYS_MATH_EXTRAS_H_
21
22
#include <
zephyr/types.h
>
23
#include <
stdbool.h
>
24
#include <stddef.h>
25
41
static
bool
u16_add_overflow
(
uint16_t
a,
uint16_t
b,
uint16_t
*result);
42
51
static
bool
u32_add_overflow
(
uint32_t
a,
uint32_t
b,
uint32_t
*result);
52
60
static
bool
u64_add_overflow
(
uint64_t
a,
uint64_t
b,
uint64_t
*result);
61
69
static
bool
size_add_overflow
(
size_t
a,
size_t
b,
size_t
*result);
70
88
static
bool
u16_mul_overflow
(
uint16_t
a,
uint16_t
b,
uint16_t
*result);
89
98
static
bool
u32_mul_overflow
(
uint32_t
a,
uint32_t
b,
uint32_t
*result);
106
static
bool
u64_mul_overflow
(
uint64_t
a,
uint64_t
b,
uint64_t
*result);
107
115
static
bool
size_mul_overflow
(
size_t
a,
size_t
b,
size_t
*result);
116
132
static
int
u32_count_leading_zeros
(
uint32_t
x);
133
139
static
int
u64_count_leading_zeros
(
uint64_t
x);
140
156
static
int
u32_count_trailing_zeros
(
uint32_t
x);
157
163
static
int
u64_count_trailing_zeros
(
uint64_t
x);
164
169
#include <
zephyr/sys/math_extras_impl.h
>
170
171
#endif
/* ZEPHYR_INCLUDE_SYS_MATH_EXTRAS_H_ */
u16_mul_overflow
static bool u16_mul_overflow(uint16_t a, uint16_t b, uint16_t *result)
Multiply two unsigned 16-bit integers.
u64_count_trailing_zeros
static int u64_count_trailing_zeros(uint64_t x)
Count the number of trailing zero bits in a 64-bit integer.
u64_mul_overflow
static bool u64_mul_overflow(uint64_t a, uint64_t b, uint64_t *result)
Multiply two unsigned 64-bit integers.
u32_add_overflow
static bool u32_add_overflow(uint32_t a, uint32_t b, uint32_t *result)
Add two unsigned 32-bit integers.
u32_mul_overflow
static bool u32_mul_overflow(uint32_t a, uint32_t b, uint32_t *result)
Multiply two unsigned 32-bit integers.
u32_count_trailing_zeros
static int u32_count_trailing_zeros(uint32_t x)
Count the number of trailing zero bits in a 32-bit integer.
u16_add_overflow
static bool u16_add_overflow(uint16_t a, uint16_t b, uint16_t *result)
Add two unsigned 16-bit integers.
size_mul_overflow
static bool size_mul_overflow(size_t a, size_t b, size_t *result)
Multiply two size_t integers.
size_add_overflow
static bool size_add_overflow(size_t a, size_t b, size_t *result)
Add two size_t integers.
u32_count_leading_zeros
static int u32_count_leading_zeros(uint32_t x)
Count the number of leading zero bits in a 32-bit integer.
u64_count_leading_zeros
static int u64_count_leading_zeros(uint64_t x)
Count the number of leading zero bits in a 64-bit integer.
u64_add_overflow
static bool u64_add_overflow(uint64_t a, uint64_t b, uint64_t *result)
Add two unsigned 64-bit integers.
types.h
math_extras_impl.h
Inline implementation of functions declared in math_extras.h.
stdbool.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition
stdint.h:90
uint64_t
__UINT64_TYPE__ uint64_t
Definition
stdint.h:91
uint16_t
__UINT16_TYPE__ uint16_t
Definition
stdint.h:89
zephyr
sys
math_extras.h
Generated on Fri Mar 14 2025 12:05:20 for Zephyr API Documentation by
1.12.0