ieee.h File Reference
Detailed Description
IEEE floating point functions.
Functions | |
void | ecleaz (eNI x) |
Clear (zero-out) the given value. | |
idaman THREAD_SAFE void ida_export | emovo (const eNI a, eNE b) |
Move eNI => eNE. | |
idaman THREAD_SAFE void ida_export | emovi (const eNE a, eNI b) |
Move eNE => eNI. | |
idaman THREAD_SAFE int ida_export | eshift (eNI x, int sc) |
Shift NI format up (+) or down. | |
idaman THREAD_SAFE int ida_export | emdnorm (eNI s, int lost, int subflg, int32 exp, int rndbase) |
Normalize and round off. More... | |
idaman THREAD_SAFE int ida_export | ieee_realcvt (void *m, eNE e, uint16 swt) |
Standard IEEE 754 floating point conversion function. More... | |
idaman THREAD_SAFE int ida_export | ecmp (const eNE a, const eNE b) |
Comparison. More... | |
idaman THREAD_SAFE fpvalue_kind_t ida_export | get_fpvalue_kind (const eNE a, uint16 max_exp) |
See fpvalue_kind_t. | |
Prototypes | |
IDP module event prototype – should be implemented in idp | |
int idaapi | realcvt (void *m, eNE e, uint16 swt) |
Floating point conversion function: implemented by processor_t::realcvt. More... | |
int | l_realcvt (void *m, eNE e, uint16 swt) |
Little endian. | |
int | b_realcvt (void *m, eNE e, uint16 swt) |
Big endian. | |
Misc arithmetic/conversion functions | |||||||||||
| |||||||||||
#define | eclear(a) memset(a, 0, sizeof(eNE)) | ||||||||||
x = 0 | |||||||||||
#define | emov(a, b) memcpy(b, a, sizeof(eNE)) | ||||||||||
b = a | |||||||||||
#define | eabs(x) (x[IEEE_NE-1] &= 0x7fff) | ||||||||||
x = |x| | |||||||||||
#define | esign(x) (x[IEEE_NE-1] & 0x8000) | ||||||||||
x < 0 ? More... | |||||||||||
idaman THREAD_SAFE void ida_export | realtoasc (char *buf, size_t bufsize, const eNE x, uint mode) | ||||||||||
IEEE to ascii string. More... | |||||||||||
idaman THREAD_SAFE int ida_export | asctoreal (const char **sss, eNE y) | ||||||||||
ascii string to IEEE | |||||||||||
idaman THREAD_SAFE void ida_export | eltoe (sval_t l, eNE e) | ||||||||||
long to IEEE | |||||||||||
idaman THREAD_SAFE void ida_export | eltoe64 (int64 l, eNE e) | ||||||||||
int64 to IEEE | |||||||||||
idaman THREAD_SAFE void ida_export | eltoe64u (uint64 l, eNE e) | ||||||||||
uint64 to IEEE | |||||||||||
idaman THREAD_SAFE int ida_export | eetol (sval_t *l, const eNE a, bool roundflg) | ||||||||||
IEEE to long (+-0.5 if flg) | |||||||||||
idaman THREAD_SAFE int ida_export | eetol64 (int64 *l, const eNE a, bool roundflg) | ||||||||||
IEEE to long (+-0.5 if flg) | |||||||||||
idaman THREAD_SAFE int ida_export | eetol64u (uint64 *l, const eNE a, bool roundflg) | ||||||||||
IEEE to ulong (+-0.5 if flg) | |||||||||||
idaman THREAD_SAFE int ida_export | eldexp (const eNE a, int32 pwr2, eNE b) | ||||||||||
b = a*(2**pwr2) | |||||||||||
idaman THREAD_SAFE int ida_export | eadd (const eNE a, const eNE b, eNE c, int subflg) | ||||||||||
if(!subflg) c = a + b, else c = a - b | |||||||||||
idaman THREAD_SAFE int ida_export | emul (const eNE a, const eNE b, eNE c) | ||||||||||
c = a * b | |||||||||||
idaman THREAD_SAFE int ida_export | ediv (const eNE a, const eNE b, eNE c) | ||||||||||
c = a / b | |||||||||||
void | eneg (eNE x) | ||||||||||
x = -x | |||||||||||
Macros | |
#define | IEEE_NE 6 |
Number of 16 bit words in eNE. | |
#define | IEEE_NI (IEEE_NE+3) |
Number of 16 bit words in eNI. | |
#define | IEEE_E 1 |
Array offset to exponent. | |
#define | IEEE_M 2 |
Array offset to high guard word. | |
#define | IEEE_EXONE (0x3fff) |
The exponent of 1.0. | |
#define | EZERO { 0, 0000000,0000000,0000000,0000000,0000000 } |
#define | EONE { 0, 0000000,0000000,0000000,0100000,0x3fff } |
#define | REAL_ERROR_FORMAT -1 |
not supported format for current .idp | |
#define | REAL_ERROR_RANGE -2 |
number too big (small) for store (mem NOT modified) | |
#define | REAL_ERROR_BADDATA -3 |
illegal real data for load (IEEE data not filled) | |
Typedefs | |
typedef uint16 | eNE[IEEE_NE] |
External x type format. | |
typedef uint16 | eNI[IEEE_NI] |
Internal format: More... | |
Enumerations | |
enum | fpvalue_kind_t { FPV_BADARG, FPV_NORM, FPV_NAN, FPV_PINF, FPV_NINF } |
Check for NaN/Inf. More... | |
Variables | |
const eNE | ieee_ezero |
0.0 | |
const eNE | ieee_eone |
1.0 | |
const eNE | ieee_etwo |
2.0 | |
const eNE | ieee_e32 |
32.0 | |
const eNE | ieee_elog2 |
6.93147180559945309417232121458176568075500134360255E-1 | |
const eNE | ieee_esqrt2 |
1.41421356237309504880168872420969807856967187537695E0 | |
const eNE | ieee_eoneopi |
2/sqrt(PI) = 1.12837916709551257389615890312154517168810125865800E0 | |
const eNE | ieee_epi |
3.14159265358979323846264338327950288419716939937511E0 | |
const eNE | ieee_eeul |
5.7721566490153286060651209008240243104215933593992E-1 | |
max_exp values | |
common values for max_exp (for IEEE floating point values) | |
const uint32 | MAXEXP_FLOAT = 0x80 |
const uint32 | MAXEXP_DOUBLE = 0x400 |
const uint32 | MAXEXP_LNGDBL = 0x4000 |
Macro Definition Documentation
#define esign | ( | x | ) | (x[IEEE_NE-1] & 0x8000) |
x < 0 ?
- Note
- non standard answer is returned
Typedef Documentation
Internal format:
- 0 : sign (0/1)
- 1 : exponent (based of IEEE_EXONE). If exp = 0, value = 0.
- 2 : high word of mantissa (always zero after normalize)
Enumeration Type Documentation
enum fpvalue_kind_t |
Function Documentation
idaman THREAD_SAFE int ida_export emdnorm | ( | eNI | s, |
int | lost, | ||
int | subflg, | ||
int32 | exp, | ||
int | rndbase | ||
) |
Normalize and round off.
- Parameters
-
s the internal format number to be rounded lost indicates whether or not the number is exact. this is the so-called sticky bit. subflg indicates whether the number was obtained by a subtraction operation. In that case if lost is nonzero then the number is slightly smaller than indicated. exp the biased exponent, which may be negative. the exponent field of "s" is ignored but is replaced by "exp" as adjusted by normalization and rounding. rndbase if 0 => is the rounding control. else is processor defined base (rndprc)
- Returns
- success
Floating point conversion function: implemented by processor_t::realcvt.
- Parameters
-
m pointer to data e internal IEEE format data swt operation: - 000: load trunc. float (DEC ^F) 2 bytes (m->e)
- 001: load float 4 bytes (m->e)
- 003: load double 8 bytes (m->e)
- 004: load long double 10 bytes (m->e)
- 005: load long double 12 bytes (m->e)
- 010: store trunc. float (DEC ^F) 2 bytes (e->m)
- 011: store float 4 bytes (e->m)
- 013: store double 8 bytes (e->m)
- 014: store long double 10 bytes (e->m)
- 015: store long double 12 bytes (e->m)
- Return values
-
1 ok
idaman THREAD_SAFE int ida_export ieee_realcvt | ( | void * | m, |
eNE | e, | ||
uint16 | swt | ||
) |
Standard IEEE 754 floating point conversion function.
See comment for realcvt().
idaman THREAD_SAFE void ida_export realtoasc | ( | char * | buf, |
size_t | bufsize, | ||
const eNE | x, | ||
uint | mode | ||
) |
IEEE to ascii string.
- Parameters
-
mode broken down into: - low byte: number of digits after '.'
- second byte: FPNUM_LENGTH
- third byte: FPNUM_DIGITS
idaman THREAD_SAFE int ida_export ecmp | ( | const eNE | a, |
const eNE | b | ||
) |
Comparison.
- Return values
-
0 if a = b 1 if a > b -1 if a < b
Generated by
