File tree 3 files changed +8
-5
lines changed
3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -132,15 +132,18 @@ namespace spades {
132
132
133
133
#ifdef __GNUC__
134
134
#define DEPRECATED (func ) func __attribute__ ((deprecated))
135
+ #define PURE __attribute__ ((pure))
135
136
#define LIKELY (cond ) __builtin_expect(!!(cond), true )
136
137
#define UNLIKELY (cond ) __builtin_expect(!!(cond), false )
137
138
#elif defined(_MSC_VER)
138
139
#define DEPRECATED (func ) __declspec(deprecated) func
139
140
#define LIKELY (cond ) (cond)
140
141
#define UNLIKELY (cond ) (cond)
142
+ #define PURE
141
143
#else
142
144
#pragma message("WARNING: You need to implement DEPRECATED for this compiler")
143
145
#define DEPRECATED (func ) func
146
+ #define PURE
144
147
#pragma message("WARNING: You need to implement LIKELY/UNLIKELY for this compiler")
145
148
#define LIKELY (cond ) (cond)
146
149
#define UNLIKELY (cond ) (cond)
Original file line number Diff line number Diff line change @@ -115,9 +115,9 @@ namespace spades {
115
115
return tmp;
116
116
}
117
117
#else
118
- static inline float fastDiv (float a, float b) { return a / b; }
119
- static inline float fastRcp (float b) { return 1 .f / b; }
120
- static inline float fastRSqrt (float b) { return 1 .f / sqrtf (b); }
118
+ static inline PURE float fastDiv (float a, float b) { return a / b; }
119
+ static inline PURE float fastRcp (float b) { return 1 .f / b; }
120
+ static inline PURE float fastRSqrt (float b) { return 1 .f / sqrtf (b); }
121
121
#endif
122
122
static inline float fastSqrt (float s) {
123
123
if (s == 0 .f )
Original file line number Diff line number Diff line change @@ -65,12 +65,12 @@ namespace spades {
65
65
}
66
66
}
67
67
68
- static inline int ToFixed8 (float v) {
68
+ static inline PURE int ToFixed8 (float v) {
69
69
int i = static_cast <int >(v * 255 .f + .5f );
70
70
return std::max (std::min (i, 255 ), 0 );
71
71
}
72
72
73
- static inline int ToFixedFactor8 (float v) {
73
+ static inline PURE int ToFixedFactor8 (float v) {
74
74
int i = static_cast <int >(v * 256 .f + .5f );
75
75
return std::max (std::min (i, 256 ), 0 );
76
76
}
You can’t perform that action at this time.
0 commit comments