 |
Gorgon Game Engine
|
Go to the documentation of this file.
9 typedef unsigned char Byte;
11 #ifdef GORGON_USE_DOUBLE
48 static const Float PI = (
Float)3.141592653589793;
71 i = i - ((i >> 1) & 0x55555555);
72 i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
73 return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
94 v = v < min ? min : (v > max ? max : v);
99 T_
Clamp(T_ v, T_ min, T_ max) {
102 return v < min ? min : (v > max ? max : v);
109 return v >= min && v < max;
116 return v >= range.
Start && v < range.
End;
123 return v >= min && v <= max;
125 template <
typename T_>
127 return (T_{} < val) - (val < T_{});
130 template <
typename T_>
132 return ((value%mod)+mod)%mod;
173 # define ENUMCLASS enum
175 # define ENUMCLASS enum class
Range(T_ start, T_ end)
Definition: Types.h:25
ItemPosition
Defines where an item is located in a list.
Definition: Types.h:158
Marks an object that can be updated.
Definition: Types.h:142
T_ Start
Definition: Types.h:42
float Float
Represents floating point data type.
Definition: Types.h:16
@ Odd
In lists denotes the item is in odd position.
Definition: Template.h:227
T_ End
Definition: Types.h:43
Root namespace for Gorgon Game Engine.
Definition: Any.h:19
uint32_t Char
Definition: Types.h:46
@ Last
Item is the last item.
bool Between(T_ v, T_ min, T_ max)
Returns if the given number is within the given range including min but excluding max.
Definition: Types.h:108
uint32_t CeilToPowerOf2(uint32_t v)
Calculate the smalllest power of two larger than this value.
Definition: Types.h:77
This class represents a range of values.
Definition: Types.h:22
T_ Difference() const
Returns the difference between start and end.
Definition: Types.h:38
T_ Clamp(T_ v, T_ min, T_ max)
Performs clamping on the given value and returns the result.
Definition: Types.h:99
virtual ~Updatable()
Definition: Types.h:144
void FitInto(T_ &v, T_ min, T_ max)
Performs clamping on the given value.
Definition: Types.h:91
int Sign(T_ val)
Definition: Types.h:126
unsigned char Byte
Represents smallest cell in memory.
Definition: Types.h:9
A class that has no members and can be used as placeholder.
Definition: Types.h:51
YesNoUnset
This enumeration helps with systems that has boolen parameters that can be unset/empty.
Definition: Types.h:63
void Normalize()
Normalizes the range ensuring Start is less than or equal to the end.
Definition: Types.h:29
@ First
Item is the first item.
T_ PositiveMod(T_ value, T_ mod)
Definition: Types.h:131
std::vector< T_ >::const_iterator end(enum_type_id< T_ >)
Definition: Enum.h:288
Parity
Marks the parity as Odd or Even.
Definition: Types.h:151
bool BetweenInclusive(T_ v, T_ min, T_ max)
Returns if the given number is within the given range including min and max.
Definition: Types.h:122
@ Alone
In a list this denotes the item alone.
Definition: Template.h:242
YesNoAuto
This enumeration helps with systems that has boolen parameters that can be detected automatically,...
Definition: Types.h:55
int NumberOfSetBits(uint32_t i)
Returns the number of bits that are 1 in a number.
Definition: Types.h:70
Where acceptable, denotes that the object will assume the ownership.
Definition: Types.h:136