IDA SDK
|
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 |
#define esign | ( | x | ) | (x[IEEE_NE-1] & 0x8000) |
x < 0 ?
Internal format:
enum fpvalue_kind_t |
idaman THREAD_SAFE int ida_export emdnorm | ( | eNI | s, |
int | lost, | ||
int | subflg, | ||
int32 | exp, | ||
int | rndbase | ||
) |
Normalize and round off.
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) |
Floating point conversion function: implemented by processor_t::realcvt.
m | pointer to data |
e | internal IEEE format data |
swt | operation:
|
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.
mode | broken down into:
|
idaman THREAD_SAFE int ida_export ecmp | ( | const eNE | a, |
const eNE | b | ||
) |
Comparison.
0 | if a = b |
1 | if a > b |
-1 | if a < b |