State-of-the-art binary code analysis tools
ieee.h File Reference

Detailed Description

IEEE floating point functions.

Classes

struct  fpvalue_t
 Processor-independent representation of a floating point value. More...
 

Functions

idaman THREAD_SAFE fpvalue_error_t ida_export ieee_realcvt (void *m, fpvalue_t *out, uint16 swt)
 Standard IEEE 754 floating point conversion function. More...
 
idaman THREAD_SAFE void ida_export realtoasc (char *buf, size_t bufsize, const fpvalue_t &x, uint mode)
 
idaman THREAD_SAFE fpvalue_error_t ida_export asctoreal (const char **sss, fpvalue_t *out)
 
idaman THREAD_SAFE void ida_export eltoe (sval_t l, fpvalue_t *vout)
 
idaman THREAD_SAFE void ida_export eltoe64 (int64 l, fpvalue_t *vout)
 
idaman THREAD_SAFE void ida_export eltoe64u (uint64 l, fpvalue_t *vout)
 
idaman THREAD_SAFE fpvalue_error_t ida_export eetol (sval_t *out, const fpvalue_t &a, bool roundflg)
 
idaman THREAD_SAFE fpvalue_error_t ida_export eetol64 (int64 *out, const fpvalue_t &a, bool roundflg)
 
idaman THREAD_SAFE fpvalue_error_t ida_export eetol64u (uint64 *out, const fpvalue_t &a, bool roundflg)
 
idaman THREAD_SAFE fpvalue_error_t ida_export eldexp (const fpvalue_t &a, int32 pwr2, fpvalue_t *zout)
 
idaman THREAD_SAFE fpvalue_error_t ida_export eadd (const fpvalue_t &a, const fpvalue_t &b, fpvalue_t *zout, bool subflg)
 
idaman THREAD_SAFE fpvalue_error_t ida_export emul (const fpvalue_t &a, const fpvalue_t &b, fpvalue_t *zout)
 
idaman THREAD_SAFE fpvalue_error_t ida_export ediv (const fpvalue_t &a, const fpvalue_t &b, fpvalue_t *zout)
 
idaman THREAD_SAFE int ida_export ecmp (const fpvalue_t &a, const fpvalue_t &b)
 
idaman THREAD_SAFE fpvalue_kind_t ida_export get_fpvalue_kind (const fpvalue_t &a, uint16 reserved=0)
 
Prototypes

IDP module event prototype – should be implemented in idp

fpvalue_error_t idaapi realcvt (void *m, fpvalue_t *out, uint16 swt)
 Floating point conversion function: implemented by processor_t::realcvt. More...
 
fpvalue_error_t l_realcvt (void *m, fpvalue_t *out, uint16 swt)
 Little endian.
 
fpvalue_error_t b_realcvt (void *m, fpvalue_t *out, uint16 swt)
 Big endian.
 

Macros

#define FPVAL_NWORDS   6
 
#define IEEE_EXONE   (0x3fff)
 The exponent of 1.0.
 
#define E_SPECIAL_EXP   0x7fff
 Exponent in fpvalue_t for NaN and Inf.
 
#define EZERO   { 0, 0000000,0000000,0000000,0000000,0000000 }
 
#define EONE   { 0, 0000000,0000000,0000000,0100000,IEEE_EXONE }
 

Enumerations

enum  fpvalue_kind_t {
  FPV_BADARG, FPV_NORM, FPV_NAN, FPV_PINF,
  FPV_NINF
}
 Floating value kinds. More...
 
enum  fpvalue_error_t {
  REAL_ERROR_OK = 0, REAL_ERROR_FORMAT = -1, REAL_ERROR_RANGE = -2, REAL_ERROR_BADDATA = -3,
  REAL_ERROR_FPOVER = 1, REAL_ERROR_BADSTR = 2, REAL_ERROR_ZERODIV = 3, REAL_ERROR_INTOVER = 4
}
 

Variables

const fpvalue_t ieee_ezero
 0.0
 
const fpvalue_t ieee_eone
 1.0
 
const fpvalue_t ieee_etwo
 2.0
 
const fpvalue_t ieee_e32
 32.0
 
const fpvalue_t ieee_elog2
 6.93147180559945309417232121458176568075500134360255E-1
 
const fpvalue_t ieee_esqrt2
 1.41421356237309504880168872420969807856967187537695E0
 
const fpvalue_t ieee_eoneopi
 2/sqrt(PI) = 1.12837916709551257389615890312154517168810125865800E0
 
const fpvalue_t ieee_epi
 3.14159265358979323846264338327950288419716939937511E0
 
const fpvalue_t 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
 

Enumeration Type Documentation

◆ fpvalue_kind_t

Floating value kinds.

They are useful when checking for NaN/Inf

Enumerator
FPV_BADARG 

wrong value of max_exp

FPV_NORM 

regular value

FPV_NAN 

NaN.

FPV_PINF 

positive infinity

FPV_NINF 

negative infinity

◆ fpvalue_error_t

Enumerator
REAL_ERROR_OK 

no error

REAL_ERROR_FORMAT 

realcvt: not supported format for current .idp

REAL_ERROR_RANGE 

realcvt: number too big (small) for store (mem NOT modified)

REAL_ERROR_BADDATA 

realcvt: illegal real data for load (IEEE data not filled)

REAL_ERROR_FPOVER 

floating overflow or underflow

REAL_ERROR_BADSTR 

asctoreal: illegal input string

REAL_ERROR_ZERODIV 

ediv: divide by 0

REAL_ERROR_INTOVER 

eetol*: integer overflow

Function Documentation

◆ ieee_realcvt()

idaman THREAD_SAFE fpvalue_error_t ida_export ieee_realcvt ( void *  m,
fpvalue_t out,
uint16  swt 
)

Standard IEEE 754 floating point conversion function.

Parameters
mpointer to data
outinternal IEEE format data
swtoperation:
  • 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) bit 0x80 forces little endian even for big endian processors
Returns
fpvalue_error_t

◆ realcvt()

fpvalue_error_t idaapi realcvt ( void *  m,
fpvalue_t out,
uint16  swt 
)

Floating point conversion function: implemented by processor_t::realcvt.

See ieee_realcvt