Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
div64.h File Reference

64-bit by 32-bit division without a 64-bit divide instruction. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <zephyr/toolchain.h>
#include <zephyr/sys/util_macro.h>

Go to the source code of this file.

Data Structures

struct  sys_div64_recip
 Reciprocal of a 32-bit divisor known only at run time. More...

Macros

#define sys_div64_u32_const(n, d)
 Divide a 64-bit value by a 32-bit constant.
#define sys_div64_u32_const_inline(n, d)
 Divide a 64-bit value by a 32-bit constant, inline.
#define sys_mod64_u32_const(n, d)
 Remainder of a 64-bit value divided by a 32-bit constant.
#define sys_sdiv64_u32_const(n, d)
 Divide a signed 64-bit value by a 32-bit constant.
#define SYS_DIV64_RECIP_INIT(d)
 Static initializer for a reciprocal of a constant divisor.

Functions

static void sys_div64_recip_init (struct sys_div64_recip *r, uint32_t d)
 Set up the reciprocal of a divisor.
static uint64_t sys_div64_recip_div (uint64_t n, const struct sys_div64_recip *r)
 Divide a 64-bit value by a reciprocal's divisor.
static uint32_t sys_div64_recip_mod (uint64_t n, const struct sys_div64_recip *r)
 Remainder of a 64-bit value divided by a reciprocal's divisor.

Detailed Description

64-bit by 32-bit division without a 64-bit divide instruction.