Skip to content

Commit

Permalink
Renamed "sub<component>" to "swap<component>" methods & fixed documen…
Browse files Browse the repository at this point in the history
…tation references
  • Loading branch information
ltmx committed Apr 13, 2024
1 parent 382e49f commit 1ebc221
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 77 deletions.
9 changes: 5 additions & 4 deletions Runtime/Structs/byte2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Runtime.CompilerServices;
using static Unity.Mathematics.math;
using static Unity.Mathematics.mathx;
using Unity.Mathematics;

#pragma warning disable 0660, 0661

Expand Down Expand Up @@ -295,9 +296,9 @@ public static partial class mathx
[MethodImpl(INLINE)] public static uint2 hashwide(byte2 v) => uint2(v.x, v.y) * uint2(0xEBD0D005u, 0x91475DF7u) + 0x55E84827u;


/// <inheritdoc cref="subx(byte4, byte)"/>
[MethodImpl(IL)] public static byte2 subx(this byte2 f, byte x) => new(x, f.y);
/// <inheritdoc cref="suby(byte4, byte)"/>
[MethodImpl(IL)] public static byte2 suby(this byte2 f, byte y) => new(f.x, y);
/// <inheritdoc cref="swapx(Unity.Mathematics.byte4, byte)"/>
[MethodImpl(IL)] public static byte2 swapx(this byte2 f, byte x) => new(x, f.y);
/// <inheritdoc cref="swapy(Unity.Mathematics.byte4, byte)"/>
[MethodImpl(IL)] public static byte2 swapy(this byte2 f, byte y) => new(f.x, y);
}
}
12 changes: 6 additions & 6 deletions Runtime/Structs/byte3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -711,11 +711,11 @@ public static partial class mathx
[MethodImpl(INLINE)] public static uint3 hashwide(byte3 v) => uint3(v.x, v.y, v.z) * uint3(0xFA3A3285u, 0xAD55999Du, 0xDCDD5341u) + 0x94DDD769u;


/// <inheritdoc cref="subx(byte4, byte)"/>
[MethodImpl(IL)] public static byte3 subx(this byte3 f, byte x) => new(x, f.y, f.z);
/// <inheritdoc cref="suby(byte4, byte)"/>
[MethodImpl(IL)] public static byte3 suby(this byte3 f, byte y) => new(f.x, y, f.z);
/// <inheritdoc cref="subz(byte4, byte)"/>
[MethodImpl(IL)] public static byte3 subz(this byte3 f, byte z) => new(f.x, f.y, z);
/// <inheritdoc cref="swapx(Unity.Mathematics.byte4, byte)"/>
[MethodImpl(IL)] public static byte3 swapx(this byte3 f, byte x) => new(x, f.y, f.z);
/// <inheritdoc cref="swapy(Unity.Mathematics.byte4, byte)"/>
[MethodImpl(IL)] public static byte3 swapy(this byte3 f, byte y) => new(f.x, y, f.z);
/// <inheritdoc cref="swapz(Unity.Mathematics.byte4, byte)"/>
[MethodImpl(IL)] public static byte3 swapz(this byte3 f, byte z) => new(f.x, f.y, z);
}
}
8 changes: 4 additions & 4 deletions Runtime/Structs/byte4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1862,12 +1862,12 @@ public static partial class mathx


/// substitutes the component x
[MethodImpl(IL)] public static byte4 subx(this byte4 f, byte x) => new(x, f.y, f.z, f.w);
[MethodImpl(IL)] public static byte4 swapx(this byte4 f, byte x) => new(x, f.y, f.z, f.w);
/// substitutes the component y
[MethodImpl(IL)] public static byte4 suby(this byte4 f, byte y) => new(f.x, y, f.z, f.w);
[MethodImpl(IL)] public static byte4 swapy(this byte4 f, byte y) => new(f.x, y, f.z, f.w);
/// substitutes the component z
[MethodImpl(IL)] public static byte4 subz(this byte4 f, byte z) => new(f.x, f.y, z, f.w);
[MethodImpl(IL)] public static byte4 swapz(this byte4 f, byte z) => new(f.x, f.y, z, f.w);
/// substitutes the component w
[MethodImpl(IL)] public static byte4 subw(this byte4 f, byte w) => new(f.x, f.y, f.z, w);
[MethodImpl(IL)] public static byte4 swapw(this byte4 f, byte w) => new(f.x, f.y, f.z, w);
}
}
8 changes: 4 additions & 4 deletions Runtime/Structs/color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1630,12 +1630,12 @@ public static partial class mathx


/// substitutes the component x
[MethodImpl(IL)] public static color subx(this color f, float x) => new(x, f.y, f.z, f.w);
[MethodImpl(IL)] public static color swapx(this color f, float x) => new(x, f.y, f.z, f.w);
/// substitutes the component y
[MethodImpl(IL)] public static color suby(this color f, float y) => new(f.x, y, f.z, f.w);
[MethodImpl(IL)] public static color swapy(this color f, float y) => new(f.x, y, f.z, f.w);
/// substitutes the component z
[MethodImpl(IL)] public static color subz(this color f, float z) => new(f.x, f.y, z, f.w);
[MethodImpl(IL)] public static color swapz(this color f, float z) => new(f.x, f.y, z, f.w);
/// substitutes the component w
[MethodImpl(IL)] public static color subw(this color f, float w) => new(f.x, f.y, f.z, w);
[MethodImpl(IL)] public static color swapw(this color f, float w) => new(f.x, f.y, f.z, w);
}
}
30 changes: 15 additions & 15 deletions Runtime/mathx.common.double.cs
Original file line number Diff line number Diff line change
Expand Up @@ -384,24 +384,24 @@ public static partial class mathx
/// applies a function to a double4 n times
[MethodImpl(IL)] public static double4 cycle(this double4 f, int n) => f.apply(cycle, n);


/// <inheritdoc cref="subx(double4, double)"/>
[MethodImpl(IL)] public static double2 subx(this double2 f, double x) => new(x, f.y);
/// <inheritdoc cref="suby(double4, double)"/>
[MethodImpl(IL)] public static double2 suby(this double2 f, double y) => new(f.x, y);
/// <inheritdoc cref="subx(double4, double)"/>
[MethodImpl(IL)] public static double3 subx(this double3 f, double x) => new(x, f.y, f.z);
/// <inheritdoc cref="suby(double4, double)"/>
[MethodImpl(IL)] public static double3 suby(this double3 f, double y) => new(f.x, y, f.z);
/// <inheritdoc cref="subz(double4, double)"/>
[MethodImpl(IL)] public static double3 subz(this double3 f, double z) => new(f.x, f.y, z);
// Swap components
/// <inheritdoc cref="swapx(Unity.Mathematics.double4,double)"/>
[MethodImpl(IL)] public static double2 swapx(this double2 f, double x) => new(x, f.y);
/// <inheritdoc cref="swapy(Unity.Mathematics.double4,double)"/>
[MethodImpl(IL)] public static double2 swapy(this double2 f, double y) => new(f.x, y);
/// <inheritdoc cref="swapx(Unity.Mathematics.double4,double)"/>
[MethodImpl(IL)] public static double3 swapx(this double3 f, double x) => new(x, f.y, f.z);
/// <inheritdoc cref="swapy(Unity.Mathematics.double4,double)"/>
[MethodImpl(IL)] public static double3 swapy(this double3 f, double y) => new(f.x, y, f.z);
/// <inheritdoc cref="swapz(Unity.Mathematics.double4,double)"/>
[MethodImpl(IL)] public static double3 swapz(this double3 f, double z) => new(f.x, f.y, z);
/// substitutes the component x
[MethodImpl(IL)] public static double4 subx(this double4 f, double x) => new(x, f.y, f.z, f.w);
[MethodImpl(IL)] public static double4 swapx(this double4 f, double x) => new(x, f.y, f.z, f.w);
/// substitutes the component y
[MethodImpl(IL)] public static double4 suby(this double4 f, double y) => new(f.x, y, f.z, f.w);
[MethodImpl(IL)] public static double4 swapy(this double4 f, double y) => new(f.x, y, f.z, f.w);
/// substitutes the component z
[MethodImpl(IL)] public static double4 subz(this double4 f, double z) => new(f.x, f.y, z, f.w);
[MethodImpl(IL)] public static double4 swapz(this double4 f, double z) => new(f.x, f.y, z, f.w);
/// substitutes the component w
[MethodImpl(IL)] public static double4 subw(this double4 f, double w) => new(f.x, f.y, f.z, w);
[MethodImpl(IL)] public static double4 swapw(this double4 f, double w) => new(f.x, f.y, f.z, w);
}
}
30 changes: 15 additions & 15 deletions Runtime/mathx.common.float.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,24 +454,24 @@ public static partial class mathx
/// cycles the components n times
[MethodImpl(IL)] public static float4 cycle(this float4 f, int n) => f.apply(cycle, n % 4);


/// <inheritdoc cref="subx(float4, float)"/>
[MethodImpl(IL)] public static float2 subx(this float2 f, float x) => new(x, f.y);
/// <inheritdoc cref="suby(float4, float)"/>
[MethodImpl(IL)] public static float2 suby(this float2 f, float y) => new(f.x, y);
/// <inheritdoc cref="subx(float4, float)"/>
[MethodImpl(IL)] public static float3 subx(this float3 f, float x) => new(x, f.y, f.z);
/// <inheritdoc cref="suby(float4, float)"/>
[MethodImpl(IL)] public static float3 suby(this float3 f, float y) => new(f.x, y, f.z);
/// <inheritdoc cref="subz(float4, float)"/>
[MethodImpl(IL)] public static float3 subz(this float3 f, float z) => new(f.x, f.y, z);
// Swap components
/// <inheritdoc cref="swapx(Unity.Mathematics.float4,float)"/>
[MethodImpl(IL)] public static float2 swapx(this float2 f, float x) => new(x, f.y);
/// <inheritdoc cref="swapy(Unity.Mathematics.float4,float)"/>
[MethodImpl(IL)] public static float2 swapy(this float2 f, float y) => new(f.x, y);
/// <inheritdoc cref="swapx(Unity.Mathematics.float4,float)"/>
[MethodImpl(IL)] public static float3 swapx(this float3 f, float x) => new(x, f.y, f.z);
/// <inheritdoc cref="swapy(Unity.Mathematics.float4,float)"/>
[MethodImpl(IL)] public static float3 swapy(this float3 f, float y) => new(f.x, y, f.z);
/// <inheritdoc cref="swapz(Unity.Mathematics.float4,float)"/>
[MethodImpl(IL)] public static float3 swapz(this float3 f, float z) => new(f.x, f.y, z);
/// substitutes the component x
[MethodImpl(IL)] public static float4 subx(this float4 f, float x) => new(x, f.y, f.z, f.w);
[MethodImpl(IL)] public static float4 swapx(this float4 f, float x) => new(x, f.y, f.z, f.w);
/// substitutes the component y
[MethodImpl(IL)] public static float4 suby(this float4 f, float y) => new(f.x, y, f.z, f.w);
[MethodImpl(IL)] public static float4 swapy(this float4 f, float y) => new(f.x, y, f.z, f.w);
/// substitutes the component z
[MethodImpl(IL)] public static float4 subz(this float4 f, float z) => new(f.x, f.y, z, f.w);
[MethodImpl(IL)] public static float4 swapz(this float4 f, float z) => new(f.x, f.y, z, f.w);
/// substitutes the component w
[MethodImpl(IL)] public static float4 subw(this float4 f, float w) => new(f.x, f.y, f.z, w);
[MethodImpl(IL)] public static float4 swapw(this float4 f, float w) => new(f.x, f.y, f.z, w);
}
}
30 changes: 15 additions & 15 deletions Runtime/mathx.common.int.cs
Original file line number Diff line number Diff line change
Expand Up @@ -424,24 +424,24 @@ public static partial class mathx
/// applies a function to a int4 n times
[MethodImpl(IL)] public static int4 cycle(this int4 f, int n) => f.apply(cycle, n);


/// <inheritdoc cref="subx(int4, int)"/>
[MethodImpl(IL)] public static int2 subx(this int2 f, int x) => new(x, f.y);
/// <inheritdoc cref="suby(int4, int)"/>
[MethodImpl(IL)] public static int2 suby(this int2 f, int y) => new(f.x, y);
/// <inheritdoc cref="subx(int4, int)"/>
[MethodImpl(IL)] public static int3 subx(this int3 f, int x) => new(x, f.y, f.z);
/// <inheritdoc cref="suby(int4, int)"/>
[MethodImpl(IL)] public static int3 suby(this int3 f, int y) => new(f.x, y, f.z);
/// <inheritdoc cref="subz(int4, int)"/>
[MethodImpl(IL)] public static int3 subz(this int3 f, int z) => new(f.x, f.y, z);
// Swap components
/// <inheritdoc cref="swapx(Unity.Mathematics.int4,int)"/>
[MethodImpl(IL)] public static int2 swapx(this int2 f, int x) => new(x, f.y);
/// <inheritdoc cref="swapy(Unity.Mathematics.int4,int)"/>
[MethodImpl(IL)] public static int2 swapy(this int2 f, int y) => new(f.x, y);
/// <inheritdoc cref="swapx(Unity.Mathematics.int4,int)"/>
[MethodImpl(IL)] public static int3 swapx(this int3 f, int x) => new(x, f.y, f.z);
/// <inheritdoc cref="swapy(Unity.Mathematics.int4,int)"/>
[MethodImpl(IL)] public static int3 swapy(this int3 f, int y) => new(f.x, y, f.z);
/// <inheritdoc cref="swapz(Unity.Mathematics.int4,int)"/>
[MethodImpl(IL)] public static int3 swapz(this int3 f, int z) => new(f.x, f.y, z);
/// substitutes the component x
[MethodImpl(IL)] public static int4 subx(this int4 f, int x) => new(x, f.y, f.z, f.w);
[MethodImpl(IL)] public static int4 swapx(this int4 f, int x) => new(x, f.y, f.z, f.w);
/// substitutes the component y
[MethodImpl(IL)] public static int4 suby(this int4 f, int y) => new(f.x, y, f.z, f.w);
[MethodImpl(IL)] public static int4 swapy(this int4 f, int y) => new(f.x, y, f.z, f.w);
/// substitutes the component z
[MethodImpl(IL)] public static int4 subz(this int4 f, int z) => new(f.x, f.y, z, f.w);
[MethodImpl(IL)] public static int4 swapz(this int4 f, int z) => new(f.x, f.y, z, f.w);
/// substitutes the component w
[MethodImpl(IL)] public static int4 subw(this int4 f, int w) => new(f.x, f.y, f.z, w);
[MethodImpl(IL)] public static int4 swapw(this int4 f, int w) => new(f.x, f.y, f.z, w);
}
}
29 changes: 15 additions & 14 deletions Runtime/mathx.common.uint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,23 +398,24 @@ public static partial class mathx
[MethodImpl(IL)] public static uint4 cycle(this uint4 f, int n) => f.apply(cycle, n);


/// <inheritdoc cref="subx(uint4, uint)"/>
[MethodImpl(IL)] public static uint2 subx(this uint2 f, uint x) => new(x, f.y);
/// <inheritdoc cref="suby(uint4, uint)"/>
[MethodImpl(IL)] public static uint2 suby(this uint2 f, uint y) => new(f.x, y);
/// <inheritdoc cref="subx(uint4, uint)"/>
[MethodImpl(IL)] public static uint3 subx(this uint3 f, uint x) => new(x, f.y, f.z);
/// <inheritdoc cref="suby(uint4, uint)"/>
[MethodImpl(IL)] public static uint3 suby(this uint3 f, uint y) => new(f.x, y, f.z);
/// <inheritdoc cref="subz(uint4, uint)"/>
[MethodImpl(IL)] public static uint3 subz(this uint3 f, uint z) => new(f.x, f.y, z);
// Swap components
/// <inheritdoc cref="swapx(Unity.Mathematics.uint4,uint)"/>
[MethodImpl(IL)] public static uint2 swapx(this uint2 f, uint x) => new(x, f.y);
/// <inheritdoc cref="swapy(Unity.Mathematics.uint4,uint)"/>
[MethodImpl(IL)] public static uint2 swapy(this uint2 f, uint y) => new(f.x, y);
/// <inheritdoc cref="swapx(Unity.Mathematics.uint4,uint)"/>
[MethodImpl(IL)] public static uint3 swapx(this uint3 f, uint x) => new(x, f.y, f.z);
/// <inheritdoc cref="swapy(Unity.Mathematics.uint4,uint)"/>
[MethodImpl(IL)] public static uint3 swapy(this uint3 f, uint y) => new(f.x, y, f.z);
/// <inheritdoc cref="swapz(Unity.Mathematics.uint4,uint)"/>
[MethodImpl(IL)] public static uint3 swapz(this uint3 f, uint z) => new(f.x, f.y, z);
/// substitutes the component x
[MethodImpl(IL)] public static uint4 subx(this uint4 f, uint x) => new(x, f.y, f.z, f.w);
[MethodImpl(IL)] public static uint4 swapx(this uint4 f, uint x) => new(x, f.y, f.z, f.w);
/// substitutes the component y
[MethodImpl(IL)] public static uint4 suby(this uint4 f, uint y) => new(f.x, y, f.z, f.w);
[MethodImpl(IL)] public static uint4 swapy(this uint4 f, uint y) => new(f.x, y, f.z, f.w);
/// substitutes the component z
[MethodImpl(IL)] public static uint4 subz(this uint4 f, uint z) => new(f.x, f.y, z, f.w);
[MethodImpl(IL)] public static uint4 swapz(this uint4 f, uint z) => new(f.x, f.y, z, f.w);
/// substitutes the component w
[MethodImpl(IL)] public static uint4 subw(this uint4 f, uint w) => new(f.x, f.y, f.z, w);
[MethodImpl(IL)] public static uint4 swapw(this uint4 f, uint w) => new(f.x, f.y, f.z, w);
}
}

0 comments on commit 1ebc221

Please sign in to comment.