JGeometry.h: reorder for better compiler compatibility

This commit is contained in:
Jcw87
2023-12-29 20:44:55 -08:00
parent ed346cbb09
commit 2aab59afe7
+23 -25
View File
@@ -7,6 +7,29 @@
namespace JGeometry {
template <typename T>
struct TUtil {
static inline f32 epsilon() { return 3.81469727e-06f; }
static inline f32 sqrt(f32 mag) {
if (mag <= 0.0f) {
return mag;
} else {
f32 root = __frsqrte(mag);
return 0.5f * root * (3.0f - mag * (root * root)) * mag;
}
}
static inline f32 inv_sqrt(f32 mag) {
if (mag <= 0.0f) {
return mag;
} else {
f32 root = __frsqrte(mag);
return 0.5f * root * (3.0f - mag * (root * root));
}
}
};
template <typename T>
struct TVec3 {
T x;
@@ -358,31 +381,6 @@ struct TBox2 : TBox<TVec2<T> > {
void set(f32 x0, f32 y0, f32 x1, f32 y1) { i.set(x0, y0); f.set(x1, y1); }
};
template<typename T>
struct TUtil {
static inline f32 epsilon() {
return 3.81469727e-06f;
}
static inline f32 sqrt(f32 mag) {
if (mag <= 0.0f) {
return mag;
} else {
f32 root = __frsqrte(mag);
return 0.5f * root * (3.0f - mag * (root * root)) * mag;
}
}
static inline f32 inv_sqrt(f32 mag) {
if (mag <= 0.0f) {
return mag;
} else {
f32 root = __frsqrte(mag);
return 0.5f * root * (3.0f - mag * (root * root));
}
}
};
// clang-format on
} // namespace JGeometry