arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
float32 Class Reference

A plain 32-bit float's bit pattern reinterpreted as a uint32_t, so instances can live in memory obtained from a capability-specific allocator (e.g. ESP32's MALLOC_CAP_32BIT, which some heap regions require for word-addressed access and won't necessarily hand out for a plain float array). Conversion to/from float is a zero-cost bitwise reinterpretation (see as_uint()/as_float()), not an encoding – unlike float16, this class is bit-for-bit identical to float and loses no precision or range; it exists purely to control storage/allocation, not to compress data. More...

#include <float32.h>

Public Member Functions

 float32 ()=default
 
 float32 (const float32 &value)
 
 float32 (float value)
 
 operator double ()
 
 operator float ()
 
 operator int ()
 
 operator int () const
 
bool operator!= (float32 other) const
 
bool operator< (float32 other) const
 
bool operator<= (float32 other) const
 
bool operator== (float32 other) const
 
bool operator> (float32 other) const
 
bool operator>= (float32 other) const
 

Static Protected Member Functions

static float as_float (uint32_t x)
 
static uint32_t as_uint (float x)
 

Protected Attributes

uint32_t value =0
 

Detailed Description

A plain 32-bit float's bit pattern reinterpreted as a uint32_t, so instances can live in memory obtained from a capability-specific allocator (e.g. ESP32's MALLOC_CAP_32BIT, which some heap regions require for word-addressed access and won't necessarily hand out for a plain float array). Conversion to/from float is a zero-cost bitwise reinterpretation (see as_uint()/as_float()), not an encoding – unlike float16, this class is bit-for-bit identical to float and loses no precision or range; it exists purely to control storage/allocation, not to compress data.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ float32() [1/3]

float32 ( )
default

◆ float32() [2/3]

float32 ( float  value)
inline

◆ float32() [3/3]

float32 ( const float32 value)
inline

Member Function Documentation

◆ as_float()

static float as_float ( uint32_t  x)
inlinestaticprotected

◆ as_uint()

static uint32_t as_uint ( float  x)
inlinestaticprotected

◆ operator double()

operator double ( )
inlineexplicit

◆ operator float()

operator float ( )
inline

◆ operator int() [1/2]

operator int ( )
inlineexplicit

◆ operator int() [2/2]

operator int ( ) const
inlineexplicit

◆ operator!=()

bool operator!= ( float32  other) const
inline

◆ operator<()

bool operator< ( float32  other) const
inline

◆ operator<=()

bool operator<= ( float32  other) const
inline

◆ operator==()

bool operator== ( float32  other) const
inline

◆ operator>()

bool operator> ( float32  other) const
inline

◆ operator>=()

bool operator>= ( float32  other) const
inline

Member Data Documentation

◆ value

uint32_t value =0
protected

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