Fast 32-bit maths
[Miscellaneous]


Detailed Description

Fast conversions.

The VM creates its own environment, which is used to (un)serialize programs. The map supports indexed access to keys and values and random access by key lookup.


Data Structures

union  _intfloat_conv
 union to reinterpret bits in a word as an integer and a float. More...
#define fast_apply_bin_int_func(_ta, _a, _tb, _b, _op, _ret)
 Ease writing of arithmetic opcodes.
#define fast_apply_bin_func(_ta, _a, _tb, _b, _opi, _opf, _ret, _ret_typ)
 Ease writing of arithmetic opcodes.

Defines

#define BIAS_HEX   ( ((23+127)<<23) + (1<<22) )
 Magic converting bias, hex version.
#define BIAS_INT   ((long int)BIAS_HEX)
 Converting bias as an int.
#define BIAS_FLOAT   ((float)12582912.0f)
 Converting bias as a float.

Typedefs

typedef union
_intfloat_conv 
_IFC

Functions

static long int f2i (float f)
 Convert from float to int.
static float i2f (long int i)
 Convert from int to float.


Define Documentation

#define BIAS_HEX   ( ((23+127)<<23) + (1<<22) )

Magic converting bias, hex version.

#define BIAS_INT   ((long int)BIAS_HEX)

Converting bias as an int.

#define BIAS_FLOAT   ((float)12582912.0f)

Converting bias as a float.

#define fast_apply_bin_int_func ( _ta,
_a,
_tb,
_b,
_op,
_ret   ) 

Value:

do {\
                _IFC _R;\
                switch((((word_t)_ta)<<1)|((word_t)_tb)) {\
                case 0:\
                        _R.i = _op((_a), (_b));\
                        break;\
                case 1:\
                        _R.i = _op((_a), f2i(_b));\
                        break;\
                case 2:\
                        _R.i = _op(f2i(_a), (_b));\
                        break;\
                case 3:\
                        _R.i = _op(f2i(_a), f2i(_b));\
                };\
                _ret=_R.i;\
        } while(0)
Ease writing of arithmetic opcodes.

#define fast_apply_bin_func ( _ta,
_a,
_tb,
_b,
_opi,
_opf,
_ret,
_ret_typ   ) 

Value:

do {\
                _IFC _R,_X,_Y;\
                switch((((word_t)_ta)<<1)|((word_t)_tb)) {\
                case 0:\
                        _R.i = _opi((_a), (_b));\
                        break;\
                case 1:\
                        _X.i = (_b);\
                        _R.f = _opf(i2f(_a), _X.f);\
                        break;\
                case 2:\
                        _X.i = (_a);\
                        _R.f = _opf(_X.f, i2f(_b));\
                        break;\
                case 3:\
                        _X.i = (_a);\
                        _Y.i = (_b);\
                        _R.f = _opf(_X.f, _Y.f);\
                };\
                _ret_typ=(_ta|_tb);\
                _ret=_R.i;\
        } while(0)
Ease writing of arithmetic opcodes.


Typedef Documentation

typedef union _intfloat_conv _IFC

_brief Public type for conversion union.


Function Documentation

static long int f2i ( float  f  )  [inline, static]

Convert from float to int.

static float i2f ( long int  i  )  [inline, static]

Convert from int to float.


Generated on Wed Feb 6 14:46:05 2008 for TinyaML by  doxygen 1.5.3