DSC Engine
Loading...
Searching...
No Matches
sf24.hpp
Go to the documentation of this file.
1
6#pragma once
7
8namespace DSC
9{
12 class sf24
13 {
14 private:
15 unsigned int data;
16 static sf24 create_from_data(unsigned int data);
17 public:
18 sf24();
24 sf24(short x);
25
32 sf24(short x, unsigned char frac);
33
39 short get_int() const;
40
46 unsigned char get_frac() const;
47
48
49 sf24 operator + (const sf24& b) const;
50 sf24 operator - (const sf24& b) const;
51 sf24 operator * (const sf24& b) const;
52
53 sf24 operator -() const;
54 sf24& operator += (const sf24& b);
55 sf24& operator -= (const sf24& b);
56 //void operator *= (const sf24& b);
57
67 explicit operator int() const;
68
78 explicit operator short() const;
79
80 bool operator < (const sf24& b) const;
81 bool operator > (const sf24& b) const;
82 bool operator <= (const sf24& b) const;
83 bool operator >= (const sf24& b) const;
84 bool operator == (const sf24& b) const;
85 bool operator != (const sf24& b) const;
86
94 bool in_range(const sf24& min, const sf24& max) const;
95
96 char* to_string() const;
97
98 sf24 abs() const;
99 };
100}
24-bit (16.8) signed fixed floating point number
Definition: sf24.hpp:13
short get_int() const
Gets integral part of number.
unsigned char get_frac() const
Gets fractional part of number.
sf24(short x)
Implicit s16 to sf24 conversion.
bool in_range(const sf24 &min, const sf24 &max) const
Checks if the number belongs to an interval.
sf24(short x, unsigned char frac)
Builds a signed fixed number from its separate integral and fractional part.