Colobot
Public Member Functions | Public Attributes | List of all members
Math::half Struct Reference

half-precision floating point type More...

#include <src/math/half.h>

Public Member Functions

 half ()
 Default constructor. More...
 
 half (const half &other)
 Copy constructor. More...
 
halfoperator= (const half &other)
 Copy operator. More...
 
 half (int value)
 Conversion constructor from int. More...
 
 half (float value)
 Conversion constructor from float. More...
 
 operator int () const
 Conversion operator to int. More...
 
 operator float () const
 Conversion operator to float. More...
 

Public Attributes

uint16_t bits
 16-bit binary representation of half-float More...
 

Detailed Description

half-precision floating point type

Represents a half-precision floating point value. Contains the required methods for converting to and from ints and floats.

This type is for storage only. Conversion is expensive and should be avoided if possible.

Constructor & Destructor Documentation

◆ half() [1/4]

Math::half::half ( )
inline

Default constructor.

◆ half() [2/4]

Math::half::half ( const half other)
inline

Copy constructor.

◆ half() [3/4]

Math::half::half ( int  value)
inlineexplicit

Conversion constructor from int.

◆ half() [4/4]

Math::half::half ( float  value)
inlineexplicit

Conversion constructor from float.

Member Function Documentation

◆ operator=()

half & Math::half::operator= ( const half other)
inline

Copy operator.

◆ operator int()

Math::half::operator int ( ) const
inlineexplicit

Conversion operator to int.

◆ operator float()

Math::half::operator float ( ) const
inlineexplicit

Conversion operator to float.

Member Data Documentation

◆ bits

uint16_t Math::half::bits

16-bit binary representation of half-float


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