libyasm
|
YASM floating point (IEEE) interface. More...
Go to the source code of this file.
Functions | |
YASM_LIB_DECL void | yasm_floatnum_initialize (void) |
Initialize floatnum internal data structures. More... | |
YASM_LIB_DECL void | yasm_floatnum_cleanup (void) |
Clean up internal floatnum allocations. More... | |
YASM_LIB_DECL yasm_floatnum * | yasm_floatnum_create (const char *str) |
Create a new floatnum from a decimal string. More... | |
YASM_LIB_DECL yasm_floatnum * | yasm_floatnum_copy (const yasm_floatnum *flt) |
Duplicate a floatnum. More... | |
YASM_LIB_DECL void | yasm_floatnum_destroy (yasm_floatnum *flt) |
Destroy (free allocated memory for) a floatnum. More... | |
YASM_LIB_DECL int | yasm_floatnum_calc (yasm_floatnum *acc, yasm_expr_op op, yasm_floatnum *operand) |
Floating point calculation function: acc = acc op operand. More... | |
YASM_LIB_DECL int | yasm_floatnum_get_int (const yasm_floatnum *flt, unsigned long *ret_val) |
Convert a floatnum to single-precision and return as 32-bit value. More... | |
YASM_LIB_DECL int | yasm_floatnum_get_sized (const yasm_floatnum *flt, unsigned char *ptr, size_t destsize, size_t valsize, size_t shift, int bigendian, int warn) |
Output a yasm_floatnum to buffer in little-endian or big-endian. More... | |
YASM_LIB_DECL int | yasm_floatnum_check_size (const yasm_floatnum *flt, size_t size) |
Basic check to see if size is valid for flt conversion (using yasm_floatnum_get_sized()). More... | |
YASM_LIB_DECL void | yasm_floatnum_print (const yasm_floatnum *flt, FILE *f) |
Print various representations of a floatnum. More... | |
YASM floating point (IEEE) interface.
Definition in file floatnum.h.
YASM_LIB_DECL int yasm_floatnum_calc | ( | yasm_floatnum * | acc, |
yasm_expr_op | op, | ||
yasm_floatnum * | operand | ||
) |
Floating point calculation function: acc = acc op operand.
acc | floatnum accumulator |
op | operation |
operand | floatnum operand |
YASM_LIB_DECL int yasm_floatnum_check_size | ( | const yasm_floatnum * | flt, |
size_t | size | ||
) |
Basic check to see if size is valid for flt conversion (using yasm_floatnum_get_sized()).
Doesn't actually check for underflow/overflow but rather checks for size=32,64,80 (at present).
flt | floatnum |
size | number of bits of output space |
YASM_LIB_DECL void yasm_floatnum_cleanup | ( | void | ) |
Clean up internal floatnum allocations.
YASM_LIB_DECL yasm_floatnum* yasm_floatnum_copy | ( | const yasm_floatnum * | flt | ) |
Duplicate a floatnum.
flt | floatnum |
YASM_LIB_DECL yasm_floatnum* yasm_floatnum_create | ( | const char * | str | ) |
Create a new floatnum from a decimal string.
The input string must be in standard C representation ([+-]123.456e[-+]789).
str | floating point decimal string |
YASM_LIB_DECL void yasm_floatnum_destroy | ( | yasm_floatnum * | flt | ) |
Destroy (free allocated memory for) a floatnum.
flt | floatnum |
YASM_LIB_DECL int yasm_floatnum_get_int | ( | const yasm_floatnum * | flt, |
unsigned long * | ret_val | ||
) |
Convert a floatnum to single-precision and return as 32-bit value.
The 32-bit value is a "standard" C value (eg, of unknown endian).
flt | floatnum |
ret_val | pointer to storage for 32-bit output |
YASM_LIB_DECL int yasm_floatnum_get_sized | ( | const yasm_floatnum * | flt, |
unsigned char * | ptr, | ||
size_t | destsize, | ||
size_t | valsize, | ||
size_t | shift, | ||
int | bigendian, | ||
int | warn | ||
) |
Output a yasm_floatnum to buffer in little-endian or big-endian.
Puts the value into the least significant bits of the destination, or may be shifted into more significant bits by the shift parameter. The destination bits are cleared before being set. [0] should be the first byte output to the file.
flt | floatnum |
ptr | pointer to storage for size bytes of output |
destsize | destination size (in bytes) |
valsize | size (in bits) |
shift | left shift (in bits) |
bigendian | endianness (nonzero=big, zero=little) |
warn | enables standard overflow/underflow warnings |
YASM_LIB_DECL void yasm_floatnum_initialize | ( | void | ) |
Initialize floatnum internal data structures.
YASM_LIB_DECL void yasm_floatnum_print | ( | const yasm_floatnum * | flt, |
FILE * | f | ||
) |
Print various representations of a floatnum.
For debugging purposes only.
f | file |
flt | floatnum |