Numworks Epsilon  1.4.1
Graphing Calculator Operating System
smallint.h File Reference
#include "py/mpconfig.h"
#include "py/misc.h"

Go to the source code of this file.

Macros

#define MP_SMALL_INT_MIN   ((mp_int_t)(((mp_int_t)WORD_MSBIT_HIGH) >> 1))
 
#define MP_SMALL_INT_FITS(n)   ((((n) ^ ((n) << 1)) & WORD_MSBIT_HIGH) == 0)
 
#define MP_SMALL_INT_POSITIVE_MASK   ~(WORD_MSBIT_HIGH | (WORD_MSBIT_HIGH >> 1))
 
#define MP_SMALL_INT_MAX   ((mp_int_t)(~(MP_SMALL_INT_MIN)))
 

Functions

bool mp_small_int_mul_overflow (mp_int_t x, mp_int_t y)
 
mp_int_t mp_small_int_modulo (mp_int_t dividend, mp_int_t divisor)
 
mp_int_t mp_small_int_floor_divide (mp_int_t num, mp_int_t denom)
 

Macro Definition Documentation

◆ MP_SMALL_INT_FITS

#define MP_SMALL_INT_FITS (   n)    ((((n) ^ ((n) << 1)) & WORD_MSBIT_HIGH) == 0)

Definition at line 40 of file smallint.h.

◆ MP_SMALL_INT_MAX

#define MP_SMALL_INT_MAX   ((mp_int_t)(~(MP_SMALL_INT_MIN)))

Definition at line 62 of file smallint.h.

◆ MP_SMALL_INT_MIN

#define MP_SMALL_INT_MIN   ((mp_int_t)(((mp_int_t)WORD_MSBIT_HIGH) >> 1))

Definition at line 39 of file smallint.h.

◆ MP_SMALL_INT_POSITIVE_MASK

#define MP_SMALL_INT_POSITIVE_MASK   ~(WORD_MSBIT_HIGH | (WORD_MSBIT_HIGH >> 1))

Definition at line 42 of file smallint.h.

Function Documentation

◆ mp_small_int_floor_divide()

mp_int_t mp_small_int_floor_divide ( mp_int_t  num,
mp_int_t  denom 
)

Definition at line 64 of file smallint.c.

◆ mp_small_int_modulo()

mp_int_t mp_small_int_modulo ( mp_int_t  dividend,
mp_int_t  divisor 
)

Definition at line 55 of file smallint.c.

◆ mp_small_int_mul_overflow()

bool mp_small_int_mul_overflow ( mp_int_t  x,
mp_int_t  y 
)

Definition at line 29 of file smallint.c.