mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- $$MASK_TO_INT and $$INT_TO_MASK to create bool masks from integers and back.
- Fix bug when creating bool vectors in certain cases.
This commit is contained in:
@@ -462,6 +462,7 @@ macro swizzle(v, ...) @builtin
|
||||
return $$swizzle(v, $vasplat);
|
||||
}
|
||||
|
||||
|
||||
<*
|
||||
Shuffle two vectors by a common index from arranging the vectors sequentially in memory
|
||||
|
||||
|
||||
@@ -3,6 +3,20 @@
|
||||
module std::math::vector;
|
||||
import std::math;
|
||||
|
||||
<*
|
||||
@require $Type.kindof == VECTOR &&& $kindof(($Type){}[0]) == BOOL : "Expected a bool vector"
|
||||
@require $kindof(mask).is_int() : "Expected an integer mask"
|
||||
*>
|
||||
macro bool[<*>] mask_from_int($Type, mask)
|
||||
{
|
||||
return $$int_to_mask(mask, $Type.len);
|
||||
}
|
||||
|
||||
macro bool[<*>].mask_to_int(self)
|
||||
{
|
||||
return $$mask_to_int(self);
|
||||
}
|
||||
|
||||
macro double double[<*>].sq_magnitude(self) => self.dot(self);
|
||||
macro float float[<*>].sq_magnitude(self) => self.dot(self);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user