31 inline uchar HighByte(uint16 b)
32 {
return (uchar)(b >> 8); }
33 inline uchar LowByte(uint16 b)
34 {
return (uchar)(b & 0x00FF); }
36 inline uint16 LoWrd(uint32 l)
37 {
return (uint16)(l); }
38 inline uint16 HiWrd(uint32 l)
39 {
return (uint16)(l >> 16); }
42 inline T minimum(
const T& a1,
const T& b1)
43 {
return a1 < b1 ? a1 : b1; }
46 inline T maximum(
const T& a1,
const T& b1)
47 {
return b1 < a1 ? a1 : b1; }
52 inline int32 sign(
double a)
53 {
return (a > 0.0 ? 1 : (a == 0.0 ? 0 : -1)); }
55 inline int32 sign(int32 a)
56 {
return (a > 0 ? 1 : (a == 0 ? 0 : -1)); }
58 inline bool32 Even(int32 x)
59 {
return (bool32)(!(x & 1)); }
60 inline bool32 Odd(int32 x)
61 {
return (bool32)(x & 1); }
63 const double kFixedScale = 65536.0;
64 const double kInverseFixedScale = 0.0000152587890625;
67 inline PMReal ToRealNumber(Fixed fx)
68 {
return int32(fx) * kInverseFixedScale; }
77 inline void ResetFPUException()
79 if (kDefaultFPUExceptions != _control87(0,0))
81 _control87( kDefaultFPUExceptions, 0xfffff );
85 _control87( kDefaultFPUExceptions, _MCW_DN | _MCW_EM | _MCW_RC);
89 #elif defined(MACINTOSH) || defined(WASM) 91 inline void ResetFPUException()
99 #define ELEM_COUNT(array) (sizeof(array)/sizeof(array[0]))