Photon Fusion 2.0.3

Static Public Member Functions | Static Public Attributes | List of all members
FloatUtils Class Reference

Provides utility methods for compressing and decompressing float values. More...

Static Public Member Functions

static unsafe int Compress (float f, int accuracy=DEFAULT_ACCURACY)
 Compresses a float value. More...
 
static unsafe float Decompress (int value, float accuracy=DEFAULT_ACCURACY)
 Decompresses a compressed float value. More...
 

Static Public Attributes

const int DEFAULT_ACCURACY = 1 << 10
 Default accuracy for float compression and decompression. More...
 

Detailed Description

Provides utility methods for compressing and decompressing float values.

Member Function Documentation

◆ Compress()

static unsafe int Compress ( float  f,
int  accuracy = DEFAULT_ACCURACY 
)
static

Compresses a float value.

Parameters
fThe float value to compress.
accuracyThe accuracy to use for compression. Defaults to DEFAULT_ACCURACY.
Returns
The compressed float value.

◆ Decompress()

static unsafe float Decompress ( int  value,
float  accuracy = DEFAULT_ACCURACY 
)
static

Decompresses a compressed float value.

Parameters
valueThe compressed float value to decompress.
accuracyThe accuracy to use for decompression. Defaults to DEFAULT_ACCURACY.
Returns
The decompressed float value.

Member Data Documentation

◆ DEFAULT_ACCURACY

const int DEFAULT_ACCURACY = 1 << 10
static

Default accuracy for float compression and decompression.