Zephyr API Documentation
2.7.0-rc2
A Scalable Open Source RTOS
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
17
#ifndef ZEPHYR_INCLUDE_SYS_MATH_EXTRAS_H_
18
#define ZEPHYR_INCLUDE_SYS_MATH_EXTRAS_H_
19
20
#include <
zephyr/types.h
>
21
#include <
stdbool.h
>
22
#include <stddef.h>
23
31
static
bool
u16_add_overflow
(
uint16_t
a,
uint16_t
b,
uint16_t
*
result
);
32
static
bool
u32_add_overflow
(
uint32_t
a,
uint32_t
b,
uint32_t
*
result
);
33
static
bool
u64_add_overflow
(
uint64_t
a,
uint64_t
b,
uint64_t
*
result
);
34
static
bool
size_add_overflow
(
size_t
a,
size_t
b,
size_t
*
result
);
44
static
bool
u16_mul_overflow
(
uint16_t
a,
uint16_t
b,
uint16_t
*
result
);
45
static
bool
u32_mul_overflow
(
uint32_t
a,
uint32_t
b,
uint32_t
*
result
);
46
static
bool
u64_mul_overflow
(
uint64_t
a,
uint64_t
b,
uint64_t
*
result
);
47
static
bool
size_mul_overflow
(
size_t
a,
size_t
b,
size_t
*
result
);
57
static
int
u32_count_leading_zeros
(
uint32_t
x);
58
static
int
u64_count_leading_zeros
(
uint64_t
x);
68
static
int
u32_count_trailing_zeros
(
uint32_t
x);
69
static
int
u64_count_trailing_zeros
(
uint64_t
x);
72
#include <
sys/math_extras_impl.h
>
73
74
#endif
/* ZEPHYR_INCLUDE_SYS_MATH_EXTRAS_H_ */
types.h
u16_mul_overflow
static bool u16_mul_overflow(uint16_t a, uint16_t b, uint16_t *result)
u64_count_trailing_zeros
static int u64_count_trailing_zeros(uint64_t x)
u64_mul_overflow
static bool u64_mul_overflow(uint64_t a, uint64_t b, uint64_t *result)
u32_add_overflow
static bool u32_add_overflow(uint32_t a, uint32_t b, uint32_t *result)
u32_mul_overflow
static bool u32_mul_overflow(uint32_t a, uint32_t b, uint32_t *result)
u32_count_trailing_zeros
static int u32_count_trailing_zeros(uint32_t x)
u16_add_overflow
static bool u16_add_overflow(uint16_t a, uint16_t b, uint16_t *result)
size_mul_overflow
static bool size_mul_overflow(size_t a, size_t b, size_t *result)
size_add_overflow
static bool size_add_overflow(size_t a, size_t b, size_t *result)
u32_count_leading_zeros
static int u32_count_leading_zeros(uint32_t x)
u64_count_leading_zeros
static int u64_count_leading_zeros(uint64_t x)
u64_add_overflow
static bool u64_add_overflow(uint64_t a, uint64_t b, uint64_t *result)
math_extras_impl.h
Inline implementation of functions declared in math_extras.h.
stdbool.h
uint32_t
__UINT32_TYPE__ uint32_t
Definition:
stdint.h:60
uint64_t
__UINT64_TYPE__ uint64_t
Definition:
stdint.h:61
uint16_t
__UINT16_TYPE__ uint16_t
Definition:
stdint.h:59
result
Definition:
errno.c:36
include
sys
math_extras.h
Generated on Sun Oct 9 2022 09:21:57 for Zephyr API Documentation by
1.9.4