-
-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix definitions of type_min
and type_zero
in xr_types.h
#1510
base: dev
Are you sure you want to change the base?
Conversation
This is related to #195. One of the reasons why this inconsistency still wasn't fixed is that I really don't know if everything will work correct after the change. Knowing the codebase, some code logic could depend on this inconsistency. The situation when some code was broken because another unrelated code has been changed happened many times |
13a36a3
to
1b49451
Compare
Okay I've now added type_lowest and accompanying constants and changed all usages of these constants across the code base to keep the old behavior. Making these changes I'm a bit suspicious about some of the uses of |
@@ -243,7 +243,7 @@ void CLightProjector::calculate() | |||
v.sub(v_Cs, v_C); | |||
; | |||
#ifdef DEBUG | |||
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_zero) | |||
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_min) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this ever be true?
@@ -155,7 +155,7 @@ _matrix<T>& _matrix<T>::invert(const _matrix<T>& a) // important: this is 4x3 | |||
a._12 * (a._21 * a._33 - a._23 * a._31) + | |||
a._13 * (a._21 * a._32 - a._22 * a._31)); | |||
|
|||
VERIFY(_abs(fDetInv) > flt_zero); | |||
VERIFY(_abs(fDetInv) > flt_min); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar here this would always be true since flt_min
is negative
1b49451
to
eea5ffe
Compare
eea5ffe
to
80bfd73
Compare
The following usages across the code base were changed `flt_min` -> `flt_lowest` `flt_zero` -> `flt_min` `dbl_zero` -> `dbl_min`
80bfd73
to
fda0f0a
Compare
143d1ca
to
118d39d
Compare
5b2ec76
to
6fffce9
Compare
e89fcc8
to
f6fd5cc
Compare
While looking at the code inside
xr_types.h
I've notices some very strange definitions which are used later in the code to define constants.type_min
is not the minimum value of integer types it is actually the minimum + 1. This only works for floating point types.type_zero
is the actual minimum of a type. But is only 0 for unsigned types. For signed types its a negative value.Thus we have some very strange constants.
Fixes #195