Fixed-Point Arithmetic. More...
Macros | |
#define | JAS_FIX_ZERO(fix_t, fracbits) |
#define | JAS_FIX_ONE(fix_t, fracbits) |
#define | JAS_FIX_HALF(fix_t, fracbits) |
#define | JAS_INTTOFIX(fix_t, fracbits, x) |
#define | JAS_FIXTOINT(fix_t, fracbits, x) |
#define | JAS_FIXTODBL(fix_t, fracbits, x) |
#define | JAS_DBLTOFIX(fix_t, fracbits, x) |
#define | JAS_FIX_ADD JAS_FIX_ADD_FAST |
#define | JAS_FIX_ADD_FAST(fix_t, fracbits, x, y) |
#define | JAS_FIX_ADD_OFLOW(fix_t, fracbits, x, y) |
#define | JAS_FIX_MUL JAS_FIX_MUL_FAST |
#define | JAS_FIX_MUL_FAST(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_MUL_OFLOW(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_MULBYINT JAS_FIX_MULBYINT_FAST |
#define | JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) |
#define | JAS_FIX_MULBYINT_OFLOW(fix_t, fracbits, x, y) |
#define | JAS_FIX_DIV JAS_FIX_DIV_FAST |
#define | JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_DIV_UFLOW(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_NEG JAS_FIX_NEG_FAST |
#define | JAS_FIX_NEG_FAST(fix_t, fracbits, x) |
#define | JAS_FIX_NEG_OFLOW(fix_t, fracbits, x) |
#define | JAS_FIX_ASL JAS_FIX_ASL_FAST |
#define | JAS_FIX_ASL_FAST(fix_t, fracbits, x, n) |
#define | JAS_FIX_ASL_OFLOW(fix_t, fracbits, x, n) |
#define | JAS_FIX_ASR JAS_FIX_ASR_FAST |
#define | JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) |
#define | JAS_FIX_ASR_UFLOW(fix_t, fracbits, x, n) |
#define | JAS_FIX_SUB(fix_t, fracbits, x, y) |
#define | JAS_FIX_PLUSEQ(fix_t, fracbits, x, y) |
#define | JAS_FIX_MINUSEQ(fix_t, fracbits, x, y) |
#define | JAS_FIX_MULEQ(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_ABS(fix_t, fracbits, x) |
#define | JAS_FIX_ISINT(fix_t, fracbits, x) |
#define | JAS_FIX_SGN(fix_t, fracbits, x) |
#define | JAS_FIX_CMP(fix_t, fracbits, x, y) |
#define | JAS_FIX_LT(fix_t, fracbits, x, y) |
#define | JAS_FIX_LTE(fix_t, fracbits, x, y) |
#define | JAS_FIX_GT(fix_t, fracbits, x, y) |
#define | JAS_FIX_GTE(fix_t, fracbits, x, y) |
#define | JAS_FIX_ROUND(fix_t, fracbits, x) |
#define | JAS_FIX_FLOOR(fix_t, fracbits, x) |
Typedefs | |
typedef int_least64_t | jas_fix_t |
Fixed-Point Arithmetic.
#define JAS_DBLTOFIX | ( | fix_t, | |
fracbits, | |||
x ) |
Convert a double to a fixed-point number.
#define JAS_FIX_ABS | ( | fix_t, | |
fracbits, | |||
x ) |
Calculate the absolute value of a fixed-point number.
#define JAS_FIX_ADD JAS_FIX_ADD_FAST |
Calculate the sum of two fixed-point numbers.
#define JAS_FIX_ADD_FAST | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Calculate the sum of two fixed-point numbers without overflow checking.
#define JAS_FIX_ADD_OFLOW | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Calculate the sum of two fixed-point numbers with overflow checking.
#define JAS_FIX_ASL JAS_FIX_ASL_FAST |
Perform an arithmetic shift left of a fixed-point number.
#define JAS_FIX_ASL_FAST | ( | fix_t, | |
fracbits, | |||
x, | |||
n ) |
Perform an arithmetic shift left of a fixed-point number without overflow checking.
#define JAS_FIX_ASL_OFLOW | ( | fix_t, | |
fracbits, | |||
x, | |||
n ) |
Perform an arithmetic shift left of a fixed-point number with overflow checking.
#define JAS_FIX_ASR JAS_FIX_ASR_FAST |
Perform an arithmetic shift right of a fixed-point number.
#define JAS_FIX_ASR_FAST | ( | fix_t, | |
fracbits, | |||
x, | |||
n ) |
Perform an arithmetic shift right of a fixed-point number without underflow checking.
#define JAS_FIX_ASR_UFLOW | ( | fix_t, | |
fracbits, | |||
x, | |||
n ) |
Perform an arithmetic shift right of a fixed-point number with underflow checking.
#define JAS_FIX_CMP | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Compare two fixed-point numbers.
#define JAS_FIX_DIV JAS_FIX_DIV_FAST |
Calculate the quotient of two fixed-point numbers.
#define JAS_FIX_DIV_FAST | ( | fix_t, | |
fracbits, | |||
bigfix_t, | |||
x, | |||
y ) |
Calculate the quotient of two fixed-point numbers without underflow checking.
#define JAS_FIX_DIV_UFLOW | ( | fix_t, | |
fracbits, | |||
bigfix_t, | |||
x, | |||
y ) |
Calculate the quotient of two fixed-point numbers with underflow checking.
#define JAS_FIX_FLOOR | ( | fix_t, | |
fracbits, | |||
x ) |
Round a fixed-point number to the nearest integer in the direction of negative infinity (i.e., the floor function).
#define JAS_FIX_GT | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Greater than.
#define JAS_FIX_GTE | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Greater than or equal.
#define JAS_FIX_HALF | ( | fix_t, | |
fracbits ) |
The representation of the value one half.
#define JAS_FIX_ISINT | ( | fix_t, | |
fracbits, | |||
x ) |
Is a fixed-point number an integer?
#define JAS_FIX_LT | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Less than.
#define JAS_FIX_LTE | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Less than or equal.
#define JAS_FIX_MINUSEQ | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Subtract one fixed-point number from another.
#define JAS_FIX_MUL JAS_FIX_MUL_FAST |
Calculate the product of two fixed-point numbers.
#define JAS_FIX_MUL_FAST | ( | fix_t, | |
fracbits, | |||
bigfix_t, | |||
x, | |||
y ) |
Calculate the product of two fixed-point numbers without overflow checking.
#define JAS_FIX_MUL_OFLOW | ( | fix_t, | |
fracbits, | |||
bigfix_t, | |||
x, | |||
y ) |
Calculate the product of two fixed-point numbers with overflow checking.
#define JAS_FIX_MULBYINT JAS_FIX_MULBYINT_FAST |
Calculate the product of a fixed-point number and an int.
#define JAS_FIX_MULBYINT_FAST | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Calculate the product of a fixed-point number and an int without overflow checking.
#define JAS_FIX_MULBYINT_OFLOW | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Calculate the product of a fixed-point number and an int with overflow checking.
#define JAS_FIX_MULEQ | ( | fix_t, | |
fracbits, | |||
bigfix_t, | |||
x, | |||
y ) |
Multiply one fixed-point number by another.
#define JAS_FIX_NEG JAS_FIX_NEG_FAST |
Negate a fixed-point number.
#define JAS_FIX_NEG_FAST | ( | fix_t, | |
fracbits, | |||
x ) |
Negate a fixed-point number without overflow checking.
#define JAS_FIX_NEG_OFLOW | ( | fix_t, | |
fracbits, | |||
x ) |
Negate a fixed-point number with overflow checking.
#define JAS_FIX_ONE | ( | fix_t, | |
fracbits ) |
The representation of the value one.
#define JAS_FIX_PLUSEQ | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Add one fixed-point number to another.
#define JAS_FIX_ROUND | ( | fix_t, | |
fracbits, | |||
x ) |
Round a fixed-point number to the nearest integer.
#define JAS_FIX_SGN | ( | fix_t, | |
fracbits, | |||
x ) |
Get the sign of a fixed-point number.
#define JAS_FIX_SUB | ( | fix_t, | |
fracbits, | |||
x, | |||
y ) |
Calculate the difference between two fixed-point numbers.
#define JAS_FIX_ZERO | ( | fix_t, | |
fracbits ) |
The representation of the value zero.
#define JAS_FIXTODBL | ( | fix_t, | |
fracbits, | |||
x ) |
Convert a fixed-point number to a double.
#define JAS_FIXTOINT | ( | fix_t, | |
fracbits, | |||
x ) |
Convert a fixed-point number to an int.
#define JAS_INTTOFIX | ( | fix_t, | |
fracbits, | |||
x ) |
Convert an int to a fixed-point number.
typedef int_least64_t jas_fix_t |
Integral type used for fixed-point representations.