Skip to content

Commit 1ebc221

Browse files
committed
Renamed "sub<component>" to "swap<component>" methods & fixed documentation references
1 parent 382e49f commit 1ebc221

File tree

8 files changed

+79
-77
lines changed

8 files changed

+79
-77
lines changed

Runtime/Structs/byte2.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Runtime.CompilerServices;
1111
using static Unity.Mathematics.math;
1212
using static Unity.Mathematics.mathx;
13+
using Unity.Mathematics;
1314

1415
#pragma warning disable 0660, 0661
1516

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

297298

298-
/// <inheritdoc cref="subx(byte4, byte)"/>
299-
[MethodImpl(IL)] public static byte2 subx(this byte2 f, byte x) => new(x, f.y);
300-
/// <inheritdoc cref="suby(byte4, byte)"/>
301-
[MethodImpl(IL)] public static byte2 suby(this byte2 f, byte y) => new(f.x, y);
299+
/// <inheritdoc cref="swapx(Unity.Mathematics.byte4, byte)"/>
300+
[MethodImpl(IL)] public static byte2 swapx(this byte2 f, byte x) => new(x, f.y);
301+
/// <inheritdoc cref="swapy(Unity.Mathematics.byte4, byte)"/>
302+
[MethodImpl(IL)] public static byte2 swapy(this byte2 f, byte y) => new(f.x, y);
302303
}
303304
}

Runtime/Structs/byte3.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -711,11 +711,11 @@ public static partial class mathx
711711
[MethodImpl(INLINE)] public static uint3 hashwide(byte3 v) => uint3(v.x, v.y, v.z) * uint3(0xFA3A3285u, 0xAD55999Du, 0xDCDD5341u) + 0x94DDD769u;
712712

713713

714-
/// <inheritdoc cref="subx(byte4, byte)"/>
715-
[MethodImpl(IL)] public static byte3 subx(this byte3 f, byte x) => new(x, f.y, f.z);
716-
/// <inheritdoc cref="suby(byte4, byte)"/>
717-
[MethodImpl(IL)] public static byte3 suby(this byte3 f, byte y) => new(f.x, y, f.z);
718-
/// <inheritdoc cref="subz(byte4, byte)"/>
719-
[MethodImpl(IL)] public static byte3 subz(this byte3 f, byte z) => new(f.x, f.y, z);
714+
/// <inheritdoc cref="swapx(Unity.Mathematics.byte4, byte)"/>
715+
[MethodImpl(IL)] public static byte3 swapx(this byte3 f, byte x) => new(x, f.y, f.z);
716+
/// <inheritdoc cref="swapy(Unity.Mathematics.byte4, byte)"/>
717+
[MethodImpl(IL)] public static byte3 swapy(this byte3 f, byte y) => new(f.x, y, f.z);
718+
/// <inheritdoc cref="swapz(Unity.Mathematics.byte4, byte)"/>
719+
[MethodImpl(IL)] public static byte3 swapz(this byte3 f, byte z) => new(f.x, f.y, z);
720720
}
721721
}

Runtime/Structs/byte4.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,12 +1862,12 @@ public static partial class mathx
18621862

18631863

18641864
/// substitutes the component x
1865-
[MethodImpl(IL)] public static byte4 subx(this byte4 f, byte x) => new(x, f.y, f.z, f.w);
1865+
[MethodImpl(IL)] public static byte4 swapx(this byte4 f, byte x) => new(x, f.y, f.z, f.w);
18661866
/// substitutes the component y
1867-
[MethodImpl(IL)] public static byte4 suby(this byte4 f, byte y) => new(f.x, y, f.z, f.w);
1867+
[MethodImpl(IL)] public static byte4 swapy(this byte4 f, byte y) => new(f.x, y, f.z, f.w);
18681868
/// substitutes the component z
1869-
[MethodImpl(IL)] public static byte4 subz(this byte4 f, byte z) => new(f.x, f.y, z, f.w);
1869+
[MethodImpl(IL)] public static byte4 swapz(this byte4 f, byte z) => new(f.x, f.y, z, f.w);
18701870
/// substitutes the component w
1871-
[MethodImpl(IL)] public static byte4 subw(this byte4 f, byte w) => new(f.x, f.y, f.z, w);
1871+
[MethodImpl(IL)] public static byte4 swapw(this byte4 f, byte w) => new(f.x, f.y, f.z, w);
18721872
}
18731873
}

Runtime/Structs/color.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,12 +1630,12 @@ public static partial class mathx
16301630

16311631

16321632
/// substitutes the component x
1633-
[MethodImpl(IL)] public static color subx(this color f, float x) => new(x, f.y, f.z, f.w);
1633+
[MethodImpl(IL)] public static color swapx(this color f, float x) => new(x, f.y, f.z, f.w);
16341634
/// substitutes the component y
1635-
[MethodImpl(IL)] public static color suby(this color f, float y) => new(f.x, y, f.z, f.w);
1635+
[MethodImpl(IL)] public static color swapy(this color f, float y) => new(f.x, y, f.z, f.w);
16361636
/// substitutes the component z
1637-
[MethodImpl(IL)] public static color subz(this color f, float z) => new(f.x, f.y, z, f.w);
1637+
[MethodImpl(IL)] public static color swapz(this color f, float z) => new(f.x, f.y, z, f.w);
16381638
/// substitutes the component w
1639-
[MethodImpl(IL)] public static color subw(this color f, float w) => new(f.x, f.y, f.z, w);
1639+
[MethodImpl(IL)] public static color swapw(this color f, float w) => new(f.x, f.y, f.z, w);
16401640
}
16411641
}

Runtime/mathx.common.double.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -384,24 +384,24 @@ public static partial class mathx
384384
/// applies a function to a double4 n times
385385
[MethodImpl(IL)] public static double4 cycle(this double4 f, int n) => f.apply(cycle, n);
386386

387-
388-
/// <inheritdoc cref="subx(double4, double)"/>
389-
[MethodImpl(IL)] public static double2 subx(this double2 f, double x) => new(x, f.y);
390-
/// <inheritdoc cref="suby(double4, double)"/>
391-
[MethodImpl(IL)] public static double2 suby(this double2 f, double y) => new(f.x, y);
392-
/// <inheritdoc cref="subx(double4, double)"/>
393-
[MethodImpl(IL)] public static double3 subx(this double3 f, double x) => new(x, f.y, f.z);
394-
/// <inheritdoc cref="suby(double4, double)"/>
395-
[MethodImpl(IL)] public static double3 suby(this double3 f, double y) => new(f.x, y, f.z);
396-
/// <inheritdoc cref="subz(double4, double)"/>
397-
[MethodImpl(IL)] public static double3 subz(this double3 f, double z) => new(f.x, f.y, z);
387+
// Swap components
388+
/// <inheritdoc cref="swapx(Unity.Mathematics.double4,double)"/>
389+
[MethodImpl(IL)] public static double2 swapx(this double2 f, double x) => new(x, f.y);
390+
/// <inheritdoc cref="swapy(Unity.Mathematics.double4,double)"/>
391+
[MethodImpl(IL)] public static double2 swapy(this double2 f, double y) => new(f.x, y);
392+
/// <inheritdoc cref="swapx(Unity.Mathematics.double4,double)"/>
393+
[MethodImpl(IL)] public static double3 swapx(this double3 f, double x) => new(x, f.y, f.z);
394+
/// <inheritdoc cref="swapy(Unity.Mathematics.double4,double)"/>
395+
[MethodImpl(IL)] public static double3 swapy(this double3 f, double y) => new(f.x, y, f.z);
396+
/// <inheritdoc cref="swapz(Unity.Mathematics.double4,double)"/>
397+
[MethodImpl(IL)] public static double3 swapz(this double3 f, double z) => new(f.x, f.y, z);
398398
/// substitutes the component x
399-
[MethodImpl(IL)] public static double4 subx(this double4 f, double x) => new(x, f.y, f.z, f.w);
399+
[MethodImpl(IL)] public static double4 swapx(this double4 f, double x) => new(x, f.y, f.z, f.w);
400400
/// substitutes the component y
401-
[MethodImpl(IL)] public static double4 suby(this double4 f, double y) => new(f.x, y, f.z, f.w);
401+
[MethodImpl(IL)] public static double4 swapy(this double4 f, double y) => new(f.x, y, f.z, f.w);
402402
/// substitutes the component z
403-
[MethodImpl(IL)] public static double4 subz(this double4 f, double z) => new(f.x, f.y, z, f.w);
403+
[MethodImpl(IL)] public static double4 swapz(this double4 f, double z) => new(f.x, f.y, z, f.w);
404404
/// substitutes the component w
405-
[MethodImpl(IL)] public static double4 subw(this double4 f, double w) => new(f.x, f.y, f.z, w);
405+
[MethodImpl(IL)] public static double4 swapw(this double4 f, double w) => new(f.x, f.y, f.z, w);
406406
}
407407
}

Runtime/mathx.common.float.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -454,24 +454,24 @@ public static partial class mathx
454454
/// cycles the components n times
455455
[MethodImpl(IL)] public static float4 cycle(this float4 f, int n) => f.apply(cycle, n % 4);
456456

457-
458-
/// <inheritdoc cref="subx(float4, float)"/>
459-
[MethodImpl(IL)] public static float2 subx(this float2 f, float x) => new(x, f.y);
460-
/// <inheritdoc cref="suby(float4, float)"/>
461-
[MethodImpl(IL)] public static float2 suby(this float2 f, float y) => new(f.x, y);
462-
/// <inheritdoc cref="subx(float4, float)"/>
463-
[MethodImpl(IL)] public static float3 subx(this float3 f, float x) => new(x, f.y, f.z);
464-
/// <inheritdoc cref="suby(float4, float)"/>
465-
[MethodImpl(IL)] public static float3 suby(this float3 f, float y) => new(f.x, y, f.z);
466-
/// <inheritdoc cref="subz(float4, float)"/>
467-
[MethodImpl(IL)] public static float3 subz(this float3 f, float z) => new(f.x, f.y, z);
457+
// Swap components
458+
/// <inheritdoc cref="swapx(Unity.Mathematics.float4,float)"/>
459+
[MethodImpl(IL)] public static float2 swapx(this float2 f, float x) => new(x, f.y);
460+
/// <inheritdoc cref="swapy(Unity.Mathematics.float4,float)"/>
461+
[MethodImpl(IL)] public static float2 swapy(this float2 f, float y) => new(f.x, y);
462+
/// <inheritdoc cref="swapx(Unity.Mathematics.float4,float)"/>
463+
[MethodImpl(IL)] public static float3 swapx(this float3 f, float x) => new(x, f.y, f.z);
464+
/// <inheritdoc cref="swapy(Unity.Mathematics.float4,float)"/>
465+
[MethodImpl(IL)] public static float3 swapy(this float3 f, float y) => new(f.x, y, f.z);
466+
/// <inheritdoc cref="swapz(Unity.Mathematics.float4,float)"/>
467+
[MethodImpl(IL)] public static float3 swapz(this float3 f, float z) => new(f.x, f.y, z);
468468
/// substitutes the component x
469-
[MethodImpl(IL)] public static float4 subx(this float4 f, float x) => new(x, f.y, f.z, f.w);
469+
[MethodImpl(IL)] public static float4 swapx(this float4 f, float x) => new(x, f.y, f.z, f.w);
470470
/// substitutes the component y
471-
[MethodImpl(IL)] public static float4 suby(this float4 f, float y) => new(f.x, y, f.z, f.w);
471+
[MethodImpl(IL)] public static float4 swapy(this float4 f, float y) => new(f.x, y, f.z, f.w);
472472
/// substitutes the component z
473-
[MethodImpl(IL)] public static float4 subz(this float4 f, float z) => new(f.x, f.y, z, f.w);
473+
[MethodImpl(IL)] public static float4 swapz(this float4 f, float z) => new(f.x, f.y, z, f.w);
474474
/// substitutes the component w
475-
[MethodImpl(IL)] public static float4 subw(this float4 f, float w) => new(f.x, f.y, f.z, w);
475+
[MethodImpl(IL)] public static float4 swapw(this float4 f, float w) => new(f.x, f.y, f.z, w);
476476
}
477477
}

Runtime/mathx.common.int.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -424,24 +424,24 @@ public static partial class mathx
424424
/// applies a function to a int4 n times
425425
[MethodImpl(IL)] public static int4 cycle(this int4 f, int n) => f.apply(cycle, n);
426426

427-
428-
/// <inheritdoc cref="subx(int4, int)"/>
429-
[MethodImpl(IL)] public static int2 subx(this int2 f, int x) => new(x, f.y);
430-
/// <inheritdoc cref="suby(int4, int)"/>
431-
[MethodImpl(IL)] public static int2 suby(this int2 f, int y) => new(f.x, y);
432-
/// <inheritdoc cref="subx(int4, int)"/>
433-
[MethodImpl(IL)] public static int3 subx(this int3 f, int x) => new(x, f.y, f.z);
434-
/// <inheritdoc cref="suby(int4, int)"/>
435-
[MethodImpl(IL)] public static int3 suby(this int3 f, int y) => new(f.x, y, f.z);
436-
/// <inheritdoc cref="subz(int4, int)"/>
437-
[MethodImpl(IL)] public static int3 subz(this int3 f, int z) => new(f.x, f.y, z);
427+
// Swap components
428+
/// <inheritdoc cref="swapx(Unity.Mathematics.int4,int)"/>
429+
[MethodImpl(IL)] public static int2 swapx(this int2 f, int x) => new(x, f.y);
430+
/// <inheritdoc cref="swapy(Unity.Mathematics.int4,int)"/>
431+
[MethodImpl(IL)] public static int2 swapy(this int2 f, int y) => new(f.x, y);
432+
/// <inheritdoc cref="swapx(Unity.Mathematics.int4,int)"/>
433+
[MethodImpl(IL)] public static int3 swapx(this int3 f, int x) => new(x, f.y, f.z);
434+
/// <inheritdoc cref="swapy(Unity.Mathematics.int4,int)"/>
435+
[MethodImpl(IL)] public static int3 swapy(this int3 f, int y) => new(f.x, y, f.z);
436+
/// <inheritdoc cref="swapz(Unity.Mathematics.int4,int)"/>
437+
[MethodImpl(IL)] public static int3 swapz(this int3 f, int z) => new(f.x, f.y, z);
438438
/// substitutes the component x
439-
[MethodImpl(IL)] public static int4 subx(this int4 f, int x) => new(x, f.y, f.z, f.w);
439+
[MethodImpl(IL)] public static int4 swapx(this int4 f, int x) => new(x, f.y, f.z, f.w);
440440
/// substitutes the component y
441-
[MethodImpl(IL)] public static int4 suby(this int4 f, int y) => new(f.x, y, f.z, f.w);
441+
[MethodImpl(IL)] public static int4 swapy(this int4 f, int y) => new(f.x, y, f.z, f.w);
442442
/// substitutes the component z
443-
[MethodImpl(IL)] public static int4 subz(this int4 f, int z) => new(f.x, f.y, z, f.w);
443+
[MethodImpl(IL)] public static int4 swapz(this int4 f, int z) => new(f.x, f.y, z, f.w);
444444
/// substitutes the component w
445-
[MethodImpl(IL)] public static int4 subw(this int4 f, int w) => new(f.x, f.y, f.z, w);
445+
[MethodImpl(IL)] public static int4 swapw(this int4 f, int w) => new(f.x, f.y, f.z, w);
446446
}
447447
}

Runtime/mathx.common.uint.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -398,23 +398,24 @@ public static partial class mathx
398398
[MethodImpl(IL)] public static uint4 cycle(this uint4 f, int n) => f.apply(cycle, n);
399399

400400

401-
/// <inheritdoc cref="subx(uint4, uint)"/>
402-
[MethodImpl(IL)] public static uint2 subx(this uint2 f, uint x) => new(x, f.y);
403-
/// <inheritdoc cref="suby(uint4, uint)"/>
404-
[MethodImpl(IL)] public static uint2 suby(this uint2 f, uint y) => new(f.x, y);
405-
/// <inheritdoc cref="subx(uint4, uint)"/>
406-
[MethodImpl(IL)] public static uint3 subx(this uint3 f, uint x) => new(x, f.y, f.z);
407-
/// <inheritdoc cref="suby(uint4, uint)"/>
408-
[MethodImpl(IL)] public static uint3 suby(this uint3 f, uint y) => new(f.x, y, f.z);
409-
/// <inheritdoc cref="subz(uint4, uint)"/>
410-
[MethodImpl(IL)] public static uint3 subz(this uint3 f, uint z) => new(f.x, f.y, z);
401+
// Swap components
402+
/// <inheritdoc cref="swapx(Unity.Mathematics.uint4,uint)"/>
403+
[MethodImpl(IL)] public static uint2 swapx(this uint2 f, uint x) => new(x, f.y);
404+
/// <inheritdoc cref="swapy(Unity.Mathematics.uint4,uint)"/>
405+
[MethodImpl(IL)] public static uint2 swapy(this uint2 f, uint y) => new(f.x, y);
406+
/// <inheritdoc cref="swapx(Unity.Mathematics.uint4,uint)"/>
407+
[MethodImpl(IL)] public static uint3 swapx(this uint3 f, uint x) => new(x, f.y, f.z);
408+
/// <inheritdoc cref="swapy(Unity.Mathematics.uint4,uint)"/>
409+
[MethodImpl(IL)] public static uint3 swapy(this uint3 f, uint y) => new(f.x, y, f.z);
410+
/// <inheritdoc cref="swapz(Unity.Mathematics.uint4,uint)"/>
411+
[MethodImpl(IL)] public static uint3 swapz(this uint3 f, uint z) => new(f.x, f.y, z);
411412
/// substitutes the component x
412-
[MethodImpl(IL)] public static uint4 subx(this uint4 f, uint x) => new(x, f.y, f.z, f.w);
413+
[MethodImpl(IL)] public static uint4 swapx(this uint4 f, uint x) => new(x, f.y, f.z, f.w);
413414
/// substitutes the component y
414-
[MethodImpl(IL)] public static uint4 suby(this uint4 f, uint y) => new(f.x, y, f.z, f.w);
415+
[MethodImpl(IL)] public static uint4 swapy(this uint4 f, uint y) => new(f.x, y, f.z, f.w);
415416
/// substitutes the component z
416-
[MethodImpl(IL)] public static uint4 subz(this uint4 f, uint z) => new(f.x, f.y, z, f.w);
417+
[MethodImpl(IL)] public static uint4 swapz(this uint4 f, uint z) => new(f.x, f.y, z, f.w);
417418
/// substitutes the component w
418-
[MethodImpl(IL)] public static uint4 subw(this uint4 f, uint w) => new(f.x, f.y, f.z, w);
419+
[MethodImpl(IL)] public static uint4 swapw(this uint4 f, uint w) => new(f.x, f.y, f.z, w);
419420
}
420421
}

0 commit comments

Comments
 (0)