AFBR-S50 API Reference Manual v1.5.6
AFBR-S50 Time-of-Flight Sensor SDK for Embedded Software
|
This file is part of the AFBR-S50 API. More...
#include <stdint.h>
#include <assert.h>
Go to the source code of this file.
Macros | |
#define | INT_SQRT 0 |
#define | MAX(a, b) ((a) > (b) ? (a) : (b)) |
Calculates the maximum of two values. | |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
Calculates the minimum of two values. | |
#define | CLAMP(x, min, max) (MIN(MAX((x), (min)), (max))) |
Clamps a value between a minimum and maximum boundary. | |
Functions | |
uint32_t | log2i (uint32_t x) |
Integer Base-2 Logarithm. | |
uint32_t | log2_round (uint32_t x) |
Integer Base-2 Logarithm with rounded result. | |
uint32_t | binary_round (uint32_t x) |
Finding the nearest power-of-two value. | |
uint32_t | popcount (uint32_t x) |
Counting bits set in a 32-bit unsigned integer. | |
uint32_t | ispowoftwo (uint32_t x) |
Determining if an integer is a power of 2. | |
uint32_t | absval (int32_t x) |
Calculates the absolute value. | |
uint32_t | floor2 (uint32_t x, uint_fast8_t n) |
Calculates the floor division by a factor of 2: floor(x / 2^n). | |
uint32_t | ceiling2 (uint32_t x, uint_fast8_t n) |
Calculates the ceildiv division by a factor of 2: ceildiv(x / 2^n). | |
uint32_t | ceildiv (uint32_t x, uint32_t y) |
Calculates the ceildiv division: ceildiv(x / y). | |
This file is part of the AFBR-S50 API.
Provides algorithms applied to integer values.
Copyright (c) 2023, Broadcom Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.