mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Replace $$shufflevector with $$swizzle and $$swizzle2. Add builtin swizzle accessors.
This commit is contained in:
committed by
Christoffer Lerno
parent
1e18e576c7
commit
c9e1e2d763
@@ -144,6 +144,16 @@ macro prefetch(void* ptr, PrefetchLocality $locality = VERY_NEAR, bool $write =
|
||||
$$prefetch(ptr, $write ? 1 : 0, $locality.ordinal);
|
||||
}
|
||||
|
||||
macro swizzle(v, ...) @builtin
|
||||
{
|
||||
return $$swizzle(v, $vasplat());
|
||||
}
|
||||
|
||||
macro swizzle2(v, v2, ...) @builtin
|
||||
{
|
||||
return $$swizzle2(v, v2, $vasplat());
|
||||
}
|
||||
|
||||
macro bool @castable(#expr, $To) @builtin
|
||||
{
|
||||
return $checks(($To)#expr);
|
||||
|
||||
@@ -131,8 +131,8 @@ private macro perpendicular3(v)
|
||||
|
||||
private macro cross3(v1, v2)
|
||||
{
|
||||
var a = $$shufflevector(v1, v1, { 1, 2, 0 }) * $$shufflevector(v2, v2, { 2, 0, 1 });
|
||||
var b = $$shufflevector(v1, v1, { 2, 0, 1 }) * $$shufflevector(v2, v2, { 1, 2, 0 });
|
||||
var a = v1.yzx * v2.zxy;
|
||||
var b = v1.zxy * v2.yzx;
|
||||
return a - b;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user