numpy  2.0.0
src/private/npy_extint128.h File Reference

Go to the source code of this file.

Data Structures

struct  npy_extint128_t

Functions

static NPY_INLINE npy_int64 safe_add (npy_int64 a, npy_int64 b, char *overflow_flag)
static NPY_INLINE npy_int64 safe_sub (npy_int64 a, npy_int64 b, char *overflow_flag)
static NPY_INLINE npy_int64 safe_mul (npy_int64 a, npy_int64 b, char *overflow_flag)
static NPY_INLINE npy_extint128_t to_128 (npy_int64 x)
static NPY_INLINE npy_int64 to_64 (npy_extint128_t x, char *overflow)
static NPY_INLINE npy_extint128_t mul_64_64 (npy_int64 a, npy_int64 b)
static NPY_INLINE npy_extint128_t add_128 (npy_extint128_t x, npy_extint128_t y, char *overflow)
static NPY_INLINE npy_extint128_t neg_128 (npy_extint128_t x)
static NPY_INLINE npy_extint128_t sub_128 (npy_extint128_t x, npy_extint128_t y, char *overflow)
static NPY_INLINE npy_extint128_t shl_128 (npy_extint128_t v)
static NPY_INLINE npy_extint128_t shr_128 (npy_extint128_t v)
static NPY_INLINE int gt_128 (npy_extint128_t a, npy_extint128_t b)
static NPY_INLINE npy_extint128_t divmod_128_64 (npy_extint128_t x, npy_int64 b, npy_int64 *mod)
static NPY_INLINE npy_extint128_t floordiv_128_64 (npy_extint128_t a, npy_int64 b)
static NPY_INLINE npy_extint128_t ceildiv_128_64 (npy_extint128_t a, npy_int64 b)

Function Documentation

static NPY_INLINE npy_extint128_t add_128 ( npy_extint128_t  x,
npy_extint128_t  y,
char *  overflow 
) [static]
Long integer add

References npy_extint128_t::hi.

static NPY_INLINE npy_extint128_t ceildiv_128_64 ( npy_extint128_t  a,
npy_int64  b 
) [static]
Divide and round up (positive divisor; no overflows)
static NPY_INLINE npy_extint128_t divmod_128_64 ( npy_extint128_t  x,
npy_int64  b,
npy_int64 *  mod 
) [static]
Long integer divide
Long division, not the most efficient choice
Fix signs and return; cannot overflow

References shl_128().

static NPY_INLINE npy_extint128_t floordiv_128_64 ( npy_extint128_t  a,
npy_int64  b 
) [static]
Divide and round down (positive divisor; no overflows)

Referenced by extint_shl_128().

static NPY_INLINE int gt_128 ( npy_extint128_t  a,
npy_extint128_t  b 
) [static]
static NPY_INLINE npy_extint128_t mul_64_64 ( npy_int64  a,
npy_int64  b 
) [static]
Long integer multiply
Add with carry
Long integer negation
static NPY_INLINE npy_int64 safe_add ( npy_int64  a,
npy_int64  b,
char *  overflow_flag 
) [static]
Integer addition with overflow checking

Referenced by diophantine_precompute().

static NPY_INLINE npy_int64 safe_mul ( npy_int64  a,
npy_int64  b,
char *  overflow_flag 
) [static]
Integer multiplication with overflow checking

Referenced by diophantine_precompute().

static NPY_INLINE npy_int64 safe_sub ( npy_int64  a,
npy_int64  b,
char *  overflow_flag 
) [static]
Integer subtraction with overflow checking
static NPY_INLINE npy_extint128_t sub_128 ( npy_extint128_t  x,
npy_extint128_t  y,
char *  overflow 
) [static]

Referenced by extint_safe_binop().

static NPY_INLINE npy_extint128_t to_128 ( npy_int64  x) [static]
Long integer init

Referenced by to_64().

static NPY_INLINE npy_int64 to_64 ( npy_extint128_t  x,
char *  overflow 
) [static]

References npy_extint128_t::lo, and to_128().