mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
54 lines
2 KiB
C#
54 lines
2 KiB
C#
// <auto-generated /> - edit Vector.numerics-binary.tt to modify
|
|
#nullable enable
|
|
|
|
namespace Brutal.Numerics;
|
|
|
|
// IBinaryNumber
|
|
public partial struct float3 : IBinaryNumber<float3>
|
|
{
|
|
/// <summary>Determines if every component of a value is a power of two.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
static bool IBinaryNumber<float3>.IsPow2(float3 value)
|
|
{
|
|
return float.IsPow2(value.X) && float.IsPow2(value.Y) && float.IsPow2(value.Z);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
static float3 IBitwiseOperators<float3, float3, float3>.operator &(float3 a, float3 b)
|
|
{
|
|
return Unsafe.BitCast<int3, float3>(Unsafe.BitCast<float3, int3>(a) & Unsafe.BitCast<float3, int3>(b));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
static float3 IBitwiseOperators<float3, float3, float3>.operator |(float3 a, float3 b)
|
|
{
|
|
return Unsafe.BitCast<int3, float3>(Unsafe.BitCast<float3, int3>(a) | Unsafe.BitCast<float3, int3>(b));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
static float3 IBitwiseOperators<float3, float3, float3>.operator ^(float3 a, float3 b)
|
|
{
|
|
return Unsafe.BitCast<int3, float3>(Unsafe.BitCast<float3, int3>(a) ^ Unsafe.BitCast<float3, int3>(b));
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
static float3 IBitwiseOperators<float3, float3, float3>.operator ~(float3 value)
|
|
{
|
|
return Unsafe.BitCast<int3, float3>(~Unsafe.BitCast<float3, int3>(value));
|
|
}
|
|
}
|
|
|
|
// the componentwise predicate mask (no interface to mirror) - the per-lane truth IsPow2 collapses
|
|
public partial struct float3
|
|
{
|
|
/// <summary>Determines which components of a value are powers of two.</summary>
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static bool3 IsPow2(float3 value)
|
|
{
|
|
return new bool3(float.IsPow2(value.X), float.IsPow2(value.Y), float.IsPow2(value.Z));
|
|
}
|
|
}
|