Vector comparison operators are not available for doubles and uints
egorodet opened this issue · comments
operator ==, !=, <, <=, >, >=
is not implemented for double1
, double2
, double3
, double4
types and the implementation is commented out for uint1
, uint2
, uint3
, uint4
. Meanwhile these operators are properly implemented for floats and ints.
I'm trying to use vector types in my template wrapper class Point<T, N>
which is used with floats, ints, uints and doubles and its is currently failing to compile for T=uint32_t
and T=double
because of this asymetry in underlying vector types implementation.
Would it be possible to implement these comparison operators for all vector types?
Ah yes, I have part of the code implemented locally. It shouldn't take long to add at all. Let me give it a quick go. I've always had issues determining what the == operator should return, either 0xffffffff or 1.0f for the result. Hlsl I think interprets it differently depending on what you do with it after, and will either treat it as a mask, treat it as a float with values 1.0 or 0.0, or treat is as a bool if inside a conditional. It would probably be possible to implement all this behavior through a boolN type, but for now I'll copy the same behavior that floatN has (float with 1.0 or 0.0).