Skip to content

Commit 7cd7dce

Browse files
math: fix Shared VecN comparison operators (#1419)
1 parent af1cf98 commit 7cd7dce

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/math/vec.zig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,23 +322,23 @@ pub fn VecShared(comptime Scalar: type, comptime VecN: type) type {
322322
}
323323

324324
/// Element-wise a < b
325-
pub inline fn less(a: *const VecN, b: Scalar) bool {
326-
return a.v < b.v;
325+
pub inline fn less(a: *const VecN, b: *const VecN) bool {
326+
return @reduce(.And, a.v < b.v);
327327
}
328328

329329
/// Element-wise a <= b
330-
pub inline fn lessEq(a: *const VecN, b: Scalar) bool {
331-
return a.v <= b.v;
330+
pub inline fn lessEq(a: *const VecN, b: *const VecN) bool {
331+
return @reduce(.And, a.v <= b.v);
332332
}
333333

334334
/// Element-wise a > b
335-
pub inline fn greater(a: *const VecN, b: Scalar) bool {
336-
return a.v > b.v;
335+
pub inline fn greater(a: *const VecN, b: *const VecN) bool {
336+
return @reduce(.And, a.v > b.v);
337337
}
338338

339339
/// Element-wise a >= b
340-
pub inline fn greaterEq(a: *const VecN, b: Scalar) bool {
341-
return a.v >= b.v;
340+
pub inline fn greaterEq(a: *const VecN, b: *const VecN) bool {
341+
return @reduce(.And, a.v >= b.v);
342342
}
343343

344344
/// Returns a vector with all components set to the `scalar` value:

0 commit comments

Comments
 (0)