Compute Library
 21.05
RawFloat Union Reference

#include <float_ops.h>

Public Member Functions

 RawFloat (float val)
 Constructor. More...
 
int32_t sign () const
 Extract sign of floating point number. More...
 
int32_t exponent () const
 Extract exponent of floating point number. More...
 
int32_t mantissa () const
 Extract mantissa of floating point number. More...
 

Data Fields

int32_t i32
 
float f32
 

Detailed Description

Definition at line 33 of file float_ops.h.

Constructor & Destructor Documentation

◆ RawFloat()

RawFloat ( float  val)
inlineexplicit

Constructor.

Parameters
[in]valFloating-point value

Definition at line 39 of file float_ops.h.

40  : f32(val)
41  {
42  }

Member Function Documentation

◆ exponent()

int32_t exponent ( ) const
inline

Extract exponent of floating point number.

Returns
Exponent of floating point number

Definition at line 55 of file float_ops.h.

56  {
57  return (i32 >> 23) & 0xFF;
58  }

References RawFloat::i32.

◆ mantissa()

int32_t mantissa ( ) const
inline

Extract mantissa of floating point number.

Returns
Mantissa of floating point number

Definition at line 63 of file float_ops.h.

64  {
65  return i32 & 0x007FFFFF;
66  }

References RawFloat::i32.

◆ sign()

int32_t sign ( ) const
inline

Extract sign of floating point number.

Returns
Sign of floating point number

Definition at line 47 of file float_ops.h.

48  {
49  return i32 >> 31;
50  }

References RawFloat::i32.

Field Documentation

◆ f32

float f32

Definition at line 69 of file float_ops.h.

◆ i32


The documentation for this union was generated from the following file: