From 1ebc221d71b9bd227c33faee3407b959f30ad1e2 Mon Sep 17 00:00:00 2001 From: LTMX <47640688+LTMX@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:38:15 +0200 Subject: [PATCH] Renamed "sub" to "swap" methods & fixed documentation references --- Runtime/Structs/byte2.cs | 9 +++++---- Runtime/Structs/byte3.cs | 12 ++++++------ Runtime/Structs/byte4.cs | 8 ++++---- Runtime/Structs/color.cs | 8 ++++---- Runtime/mathx.common.double.cs | 30 +++++++++++++++--------------- Runtime/mathx.common.float.cs | 30 +++++++++++++++--------------- Runtime/mathx.common.int.cs | 30 +++++++++++++++--------------- Runtime/mathx.common.uint.cs | 29 +++++++++++++++-------------- 8 files changed, 79 insertions(+), 77 deletions(-) diff --git a/Runtime/Structs/byte2.cs b/Runtime/Structs/byte2.cs index 582a545..bc2d1bb 100644 --- a/Runtime/Structs/byte2.cs +++ b/Runtime/Structs/byte2.cs @@ -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 @@ -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; - /// - [MethodImpl(IL)] public static byte2 subx(this byte2 f, byte x) => new(x, f.y); - /// - [MethodImpl(IL)] public static byte2 suby(this byte2 f, byte y) => new(f.x, y); + /// + [MethodImpl(IL)] public static byte2 swapx(this byte2 f, byte x) => new(x, f.y); + /// + [MethodImpl(IL)] public static byte2 swapy(this byte2 f, byte y) => new(f.x, y); } } \ No newline at end of file diff --git a/Runtime/Structs/byte3.cs b/Runtime/Structs/byte3.cs index ae4bc50..cc3b223 100644 --- a/Runtime/Structs/byte3.cs +++ b/Runtime/Structs/byte3.cs @@ -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; - /// - [MethodImpl(IL)] public static byte3 subx(this byte3 f, byte x) => new(x, f.y, f.z); - /// - [MethodImpl(IL)] public static byte3 suby(this byte3 f, byte y) => new(f.x, y, f.z); - /// - [MethodImpl(IL)] public static byte3 subz(this byte3 f, byte z) => new(f.x, f.y, z); + /// + [MethodImpl(IL)] public static byte3 swapx(this byte3 f, byte x) => new(x, f.y, f.z); + /// + [MethodImpl(IL)] public static byte3 swapy(this byte3 f, byte y) => new(f.x, y, f.z); + /// + [MethodImpl(IL)] public static byte3 swapz(this byte3 f, byte z) => new(f.x, f.y, z); } } \ No newline at end of file diff --git a/Runtime/Structs/byte4.cs b/Runtime/Structs/byte4.cs index 273474c..eb31d8f 100644 --- a/Runtime/Structs/byte4.cs +++ b/Runtime/Structs/byte4.cs @@ -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); } } \ No newline at end of file diff --git a/Runtime/Structs/color.cs b/Runtime/Structs/color.cs index f0c4af6..9fb4c2a 100644 --- a/Runtime/Structs/color.cs +++ b/Runtime/Structs/color.cs @@ -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); } } \ No newline at end of file diff --git a/Runtime/mathx.common.double.cs b/Runtime/mathx.common.double.cs index ca839b4..e101fd2 100644 --- a/Runtime/mathx.common.double.cs +++ b/Runtime/mathx.common.double.cs @@ -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); - - /// - [MethodImpl(IL)] public static double2 subx(this double2 f, double x) => new(x, f.y); - /// - [MethodImpl(IL)] public static double2 suby(this double2 f, double y) => new(f.x, y); - /// - [MethodImpl(IL)] public static double3 subx(this double3 f, double x) => new(x, f.y, f.z); - /// - [MethodImpl(IL)] public static double3 suby(this double3 f, double y) => new(f.x, y, f.z); - /// - [MethodImpl(IL)] public static double3 subz(this double3 f, double z) => new(f.x, f.y, z); + // Swap components + /// + [MethodImpl(IL)] public static double2 swapx(this double2 f, double x) => new(x, f.y); + /// + [MethodImpl(IL)] public static double2 swapy(this double2 f, double y) => new(f.x, y); + /// + [MethodImpl(IL)] public static double3 swapx(this double3 f, double x) => new(x, f.y, f.z); + /// + [MethodImpl(IL)] public static double3 swapy(this double3 f, double y) => new(f.x, y, f.z); + /// + [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); } } \ No newline at end of file diff --git a/Runtime/mathx.common.float.cs b/Runtime/mathx.common.float.cs index a049f87..07c83cc 100644 --- a/Runtime/mathx.common.float.cs +++ b/Runtime/mathx.common.float.cs @@ -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); - - /// - [MethodImpl(IL)] public static float2 subx(this float2 f, float x) => new(x, f.y); - /// - [MethodImpl(IL)] public static float2 suby(this float2 f, float y) => new(f.x, y); - /// - [MethodImpl(IL)] public static float3 subx(this float3 f, float x) => new(x, f.y, f.z); - /// - [MethodImpl(IL)] public static float3 suby(this float3 f, float y) => new(f.x, y, f.z); - /// - [MethodImpl(IL)] public static float3 subz(this float3 f, float z) => new(f.x, f.y, z); + // Swap components + /// + [MethodImpl(IL)] public static float2 swapx(this float2 f, float x) => new(x, f.y); + /// + [MethodImpl(IL)] public static float2 swapy(this float2 f, float y) => new(f.x, y); + /// + [MethodImpl(IL)] public static float3 swapx(this float3 f, float x) => new(x, f.y, f.z); + /// + [MethodImpl(IL)] public static float3 swapy(this float3 f, float y) => new(f.x, y, f.z); + /// + [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); } } \ No newline at end of file diff --git a/Runtime/mathx.common.int.cs b/Runtime/mathx.common.int.cs index 6a676de..bb7d9c2 100644 --- a/Runtime/mathx.common.int.cs +++ b/Runtime/mathx.common.int.cs @@ -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); - - /// - [MethodImpl(IL)] public static int2 subx(this int2 f, int x) => new(x, f.y); - /// - [MethodImpl(IL)] public static int2 suby(this int2 f, int y) => new(f.x, y); - /// - [MethodImpl(IL)] public static int3 subx(this int3 f, int x) => new(x, f.y, f.z); - /// - [MethodImpl(IL)] public static int3 suby(this int3 f, int y) => new(f.x, y, f.z); - /// - [MethodImpl(IL)] public static int3 subz(this int3 f, int z) => new(f.x, f.y, z); + // Swap components + /// + [MethodImpl(IL)] public static int2 swapx(this int2 f, int x) => new(x, f.y); + /// + [MethodImpl(IL)] public static int2 swapy(this int2 f, int y) => new(f.x, y); + /// + [MethodImpl(IL)] public static int3 swapx(this int3 f, int x) => new(x, f.y, f.z); + /// + [MethodImpl(IL)] public static int3 swapy(this int3 f, int y) => new(f.x, y, f.z); + /// + [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); } } \ No newline at end of file diff --git a/Runtime/mathx.common.uint.cs b/Runtime/mathx.common.uint.cs index c74d2be..b6b87c8 100644 --- a/Runtime/mathx.common.uint.cs +++ b/Runtime/mathx.common.uint.cs @@ -398,23 +398,24 @@ public static partial class mathx [MethodImpl(IL)] public static uint4 cycle(this uint4 f, int n) => f.apply(cycle, n); - /// - [MethodImpl(IL)] public static uint2 subx(this uint2 f, uint x) => new(x, f.y); - /// - [MethodImpl(IL)] public static uint2 suby(this uint2 f, uint y) => new(f.x, y); - /// - [MethodImpl(IL)] public static uint3 subx(this uint3 f, uint x) => new(x, f.y, f.z); - /// - [MethodImpl(IL)] public static uint3 suby(this uint3 f, uint y) => new(f.x, y, f.z); - /// - [MethodImpl(IL)] public static uint3 subz(this uint3 f, uint z) => new(f.x, f.y, z); + // Swap components + /// + [MethodImpl(IL)] public static uint2 swapx(this uint2 f, uint x) => new(x, f.y); + /// + [MethodImpl(IL)] public static uint2 swapy(this uint2 f, uint y) => new(f.x, y); + /// + [MethodImpl(IL)] public static uint3 swapx(this uint3 f, uint x) => new(x, f.y, f.z); + /// + [MethodImpl(IL)] public static uint3 swapy(this uint3 f, uint y) => new(f.x, y, f.z); + /// + [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); } } \ No newline at end of file