Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1
10#ifndef INFUSE_SDK_INCLUDE_INFUSE_MATH_COMMON_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_MATH_COMMON_H_
12
13#include <stdint.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
31#define math_abs(x) ((x) < 0 ? -(x) : (x))
32
40uint8_t math_sqrt16(uint16_t x);
41
49uint16_t math_sqrt32(uint32_t x);
50
58uint32_t math_sqrt64(uint64_t x);
59
67float math_inverse_sqrt32(float x);
68
77uint32_t math_vector_xy_sq_magnitude(int16_t x, int16_t y);
78
87uint16_t math_vector_xy_magnitude(int16_t x, int16_t y);
88
98uint32_t math_vector_xyz_sq_magnitude(int16_t x, int16_t y, int16_t z);
99
109uint16_t math_vector_xyz_magnitude(int16_t x, int16_t y, int16_t z);
110
125int64_t math_vector_xyz_dot_product(int16_t ax, int16_t ay, int16_t az, int16_t bx, int16_t by,
126 int16_t bz);
127
143int32_t math_vector_xyz_dot_product_fast(int16_t ax, int16_t ay, int16_t az, int16_t bx, int16_t by,
144 int16_t bz);
145
156uint32_t math_bitmask_get_next_bits(uint32_t bitmask, uint8_t start_idx, uint8_t *next_idx,
157 uint8_t num_bits);
158
163#ifdef __cplusplus
164}
165#endif
166
167#endif /* INFUSE_SDK_INCLUDE_INFUSE_MATH_COMMON_H_ */
uint16_t math_sqrt32(uint32_t x)
Compute square root of unsigned 32 bit number.
uint32_t math_bitmask_get_next_bits(uint32_t bitmask, uint8_t start_idx, uint8_t *next_idx, uint8_t num_bits)
Get the next N bits of a bitmask, with rollover.
float math_inverse_sqrt32(float x)
Fast inverse square root.
uint16_t math_vector_xyz_magnitude(int16_t x, int16_t y, int16_t z)
Compute the magnitude of an XYZ vector.
uint32_t math_vector_xyz_sq_magnitude(int16_t x, int16_t y, int16_t z)
Compute the squared magnitude of an XYZ vector.
uint8_t math_sqrt16(uint16_t x)
Compute square root of unsigned 16 bit number.
uint32_t math_vector_xy_sq_magnitude(int16_t x, int16_t y)
Compute the squared magnitude of an XY vector.
uint16_t math_vector_xy_magnitude(int16_t x, int16_t y)
Compute the magnitude of an XY vector.
int64_t math_vector_xyz_dot_product(int16_t ax, int16_t ay, int16_t az, int16_t bx, int16_t by, int16_t bz)
Compute the dot product of two XYZ vectors.
uint32_t math_sqrt64(uint64_t x)
Compute square root of unsigned 64 bit number.
int32_t math_vector_xyz_dot_product_fast(int16_t ax, int16_t ay, int16_t az, int16_t bx, int16_t by, int16_t bz)
Compute the dot product of two XYZ vectors.