File sstep_math.c¶
FileList > src > sstep_math.c
Go to the source code of this file
#include "sstep_math.h"#include <stdbool.h>#include <stddef.h>#include "sstep_defs.h"#include "sstep_sin_table.h"
Public Static Functions¶
| Type | Name |
|---|---|
| uint32_t | bit_length (uint64_t v) Number of significant bits of v (0 for 0); binary search, 6 steps. |
| sstep_real_t | quarter_sin (uint32_t pos) sin(pos) for 0 <= pos < 90 deg (pos in 2^-32 turn), interpolated. |
| uint64_t | ratio_round (uint64_t n, uint64_t d, uint32_t s) round(n * 2^s / d); the caller guarantees n * 2^s < 2^63. |
Macros¶
| Type | Name |
|---|---|
| define | FRAC_BITS (QUADRANT\_BITS - [**SSTEP\_CFG\_SINE\_TABLE\_BITS**](group__sstep__config.md#define-sstep_cfg_sine_table_bits))Bits of the angle below the table index (interpolation fraction). |
| define | QUADRANT_BITS 30UBits of an angle inside one quadrant. |
| define | QUADRANT_MASK 0x3FFFFFFFUMask of the angle inside one quadrant. |
| define | RATIO64_LIMIT ((int64\_t)0x4000000000000000)Operand limit of sstep_gain_from_ratio64() : 2^62. |
Public Static Functions Documentation¶
function bit_length¶
Number of significant bits of v (0 for 0); binary search, 6 steps.
function quarter_sin¶
sin(pos) for 0 <= pos < 90 deg (pos in 2^-32 turn), interpolated.
The index is at most N - 1, so idx + 1 is inside the table (N + 1 entries).
function ratio_round¶
round(n * 2^s / d); the caller guarantees n * 2^s < 2^63.
Macro Definition Documentation¶
define FRAC_BITS¶
Bits of the angle below the table index (interpolation fraction).
define QUADRANT_BITS¶
Bits of an angle inside one quadrant.
define QUADRANT_MASK¶
Mask of the angle inside one quadrant.
define RATIO64_LIMIT¶
Operand limit of sstep_gain_from_ratio64() : 2^62.
The documentation for this class was generated from the following file src/sstep_math.c