Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IceFPU.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICEFPU_H__
13 #define __ICEFPU_H__
14 
15  #define SIGN_BITMASK 0x80000000
16 
18  #define IR(x) ((udword&)(x))
19 
21  #define SIR(x) ((sdword&)(x))
22 
24  #define AIR(x) (IR(x)&0x7fffffff)
25 
27  #define FR(x) ((float&)(x))
28 
30  inline_ bool IsNAN(float value) { return (IR(value)&0x7f800000) == 0x7f800000; }
31  inline_ bool IsIndeterminate(float value) { return IR(value) == 0xffc00000; }
32  inline_ bool IsPlusInf(float value) { return IR(value) == 0x7f800000; }
33  inline_ bool IsMinusInf(float value) { return IR(value) == 0xff800000; }
34 
35  inline_ bool IsValidFloat(float value)
36  {
37  if(IsNAN(value)) return false;
38  if(IsIndeterminate(value)) return false;
39  if(IsPlusInf(value)) return false;
40  if(IsMinusInf(value)) return false;
41  return true;
42  }
43 
44  #define CHECK_VALID_FLOAT(x) OPASSERT(IsValidFloat(x));
45 
46 
47 #endif // __ICEFPU_H__