From 70b78f861c0d2f2af84b4ba62933a2d4e06c4cf6 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 27 Oct 2025 14:07:01 -0400 Subject: [PATCH] Revert "Add base type operator support to both-endian" This reverts commit 5b306ce9e8407d56f9b0dc5748c35a0a0bd95d4c. --- SabreTools.IO/Numerics/BothInt16.cs | 35 ------------------------- SabreTools.IO/Numerics/BothInt32.cs | 35 ------------------------- SabreTools.IO/Numerics/BothInt64.cs | 35 ------------------------- SabreTools.IO/Numerics/BothInt8.cs | 35 ------------------------- SabreTools.IO/Numerics/BothUInt16.cs | 35 ------------------------- SabreTools.IO/Numerics/BothUInt32.cs | 39 ++-------------------------- SabreTools.IO/Numerics/BothUInt64.cs | 35 ------------------------- SabreTools.IO/Numerics/BothUInt8.cs | 35 ------------------------- 8 files changed, 2 insertions(+), 282 deletions(-) diff --git a/SabreTools.IO/Numerics/BothInt16.cs b/SabreTools.IO/Numerics/BothInt16.cs index ebdb9d6..7608c32 100644 --- a/SabreTools.IO/Numerics/BothInt16.cs +++ b/SabreTools.IO/Numerics/BothInt16.cs @@ -14,13 +14,6 @@ namespace SabreTools.IO.Numerics return new BothInt16(le, be); } - public static BothInt16 operator +(BothInt16 a, short b) - { - short le = (short)(a.LittleEndian + b); - short be = (short)(a.BigEndian + b); - return new BothInt16(le, be); - } - public static BothInt16 operator -(BothInt16 a, BothInt16 b) { short le = (short)(a.LittleEndian - b.LittleEndian); @@ -28,13 +21,6 @@ namespace SabreTools.IO.Numerics return new BothInt16(le, be); } - public static BothInt16 operator -(BothInt16 a, short b) - { - short le = (short)(a.LittleEndian - b); - short be = (short)(a.BigEndian - b); - return new BothInt16(le, be); - } - public static BothInt16 operator *(BothInt16 a, BothInt16 b) { short le = (short)(a.LittleEndian * b.LittleEndian); @@ -42,13 +28,6 @@ namespace SabreTools.IO.Numerics return new BothInt16(le, be); } - public static BothInt16 operator *(BothInt16 a, short b) - { - short le = (short)(a.LittleEndian * b); - short be = (short)(a.BigEndian * b); - return new BothInt16(le, be); - } - public static BothInt16 operator /(BothInt16 a, BothInt16 b) { short le = (short)(a.LittleEndian / b.LittleEndian); @@ -56,13 +35,6 @@ namespace SabreTools.IO.Numerics return new BothInt16(le, be); } - public static BothInt16 operator /(BothInt16 a, short b) - { - short le = (short)(a.LittleEndian / b); - short be = (short)(a.BigEndian / b); - return new BothInt16(le, be); - } - public static BothInt16 operator ^(BothInt16 a, BothInt16 b) { short le = (short)(a.LittleEndian ^ b.LittleEndian); @@ -70,13 +42,6 @@ namespace SabreTools.IO.Numerics return new BothInt16(le, be); } - public static BothInt16 operator ^(BothInt16 a, short b) - { - short le = (short)(a.LittleEndian ^ b); - short be = (short)(a.BigEndian ^ b); - return new BothInt16(le, be); - } - public static implicit operator BothInt16(short val) => new(val, val); diff --git a/SabreTools.IO/Numerics/BothInt32.cs b/SabreTools.IO/Numerics/BothInt32.cs index ec904d6..fb5a713 100644 --- a/SabreTools.IO/Numerics/BothInt32.cs +++ b/SabreTools.IO/Numerics/BothInt32.cs @@ -14,13 +14,6 @@ namespace SabreTools.IO.Numerics return new BothInt32(le, be); } - public static BothInt32 operator +(BothInt32 a, int b) - { - int le = (int)(a.LittleEndian + b); - int be = (int)(a.BigEndian + b); - return new BothInt32(le, be); - } - public static BothInt32 operator -(BothInt32 a, BothInt32 b) { int le = (int)(a.LittleEndian - b.LittleEndian); @@ -28,13 +21,6 @@ namespace SabreTools.IO.Numerics return new BothInt32(le, be); } - public static BothInt32 operator -(BothInt32 a, int b) - { - int le = (int)(a.LittleEndian - b); - int be = (int)(a.BigEndian - b); - return new BothInt32(le, be); - } - public static BothInt32 operator *(BothInt32 a, BothInt32 b) { int le = (int)(a.LittleEndian * b.LittleEndian); @@ -42,13 +28,6 @@ namespace SabreTools.IO.Numerics return new BothInt32(le, be); } - public static BothInt32 operator *(BothInt32 a, int b) - { - int le = (int)(a.LittleEndian * b); - int be = (int)(a.BigEndian * b); - return new BothInt32(le, be); - } - public static BothInt32 operator /(BothInt32 a, BothInt32 b) { int le = (int)(a.LittleEndian / b.LittleEndian); @@ -56,13 +35,6 @@ namespace SabreTools.IO.Numerics return new BothInt32(le, be); } - public static BothInt32 operator /(BothInt32 a, int b) - { - int le = (int)(a.LittleEndian / b); - int be = (int)(a.BigEndian / b); - return new BothInt32(le, be); - } - public static BothInt32 operator ^(BothInt32 a, BothInt32 b) { int le = (int)(a.LittleEndian ^ b.LittleEndian); @@ -70,13 +42,6 @@ namespace SabreTools.IO.Numerics return new BothInt32(le, be); } - public static BothInt32 operator ^(BothInt32 a, int b) - { - int le = (int)(a.LittleEndian ^ b); - int be = (int)(a.BigEndian ^ b); - return new BothInt32(le, be); - } - public static implicit operator BothInt32(int val) => new(val, val); diff --git a/SabreTools.IO/Numerics/BothInt64.cs b/SabreTools.IO/Numerics/BothInt64.cs index 7d46c2a..881f897 100644 --- a/SabreTools.IO/Numerics/BothInt64.cs +++ b/SabreTools.IO/Numerics/BothInt64.cs @@ -14,13 +14,6 @@ namespace SabreTools.IO.Numerics return new BothInt64(le, be); } - public static BothInt64 operator +(BothInt64 a, long b) - { - long le = (long)(a.LittleEndian + b); - long be = (long)(a.BigEndian + b); - return new BothInt64(le, be); - } - public static BothInt64 operator -(BothInt64 a, BothInt64 b) { long le = (long)(a.LittleEndian - b.LittleEndian); @@ -28,13 +21,6 @@ namespace SabreTools.IO.Numerics return new BothInt64(le, be); } - public static BothInt64 operator -(BothInt64 a, long b) - { - long le = (long)(a.LittleEndian - b); - long be = (long)(a.BigEndian - b); - return new BothInt64(le, be); - } - public static BothInt64 operator *(BothInt64 a, BothInt64 b) { long le = (long)(a.LittleEndian * b.LittleEndian); @@ -42,13 +28,6 @@ namespace SabreTools.IO.Numerics return new BothInt64(le, be); } - public static BothInt64 operator *(BothInt64 a, long b) - { - long le = (long)(a.LittleEndian * b); - long be = (long)(a.BigEndian * b); - return new BothInt64(le, be); - } - public static BothInt64 operator /(BothInt64 a, BothInt64 b) { long le = (long)(a.LittleEndian / b.LittleEndian); @@ -56,13 +35,6 @@ namespace SabreTools.IO.Numerics return new BothInt64(le, be); } - public static BothInt64 operator /(BothInt64 a, long b) - { - long le = (long)(a.LittleEndian / b); - long be = (long)(a.BigEndian / b); - return new BothInt64(le, be); - } - public static BothInt64 operator ^(BothInt64 a, BothInt64 b) { long le = (long)(a.LittleEndian ^ b.LittleEndian); @@ -70,13 +42,6 @@ namespace SabreTools.IO.Numerics return new BothInt64(le, be); } - public static BothInt64 operator ^(BothInt64 a, long b) - { - long le = (long)(a.LittleEndian ^ b); - long be = (long)(a.BigEndian ^ b); - return new BothInt64(le, be); - } - public static implicit operator BothInt64(long val) => new(val, val); diff --git a/SabreTools.IO/Numerics/BothInt8.cs b/SabreTools.IO/Numerics/BothInt8.cs index 5d4a697..e168e58 100644 --- a/SabreTools.IO/Numerics/BothInt8.cs +++ b/SabreTools.IO/Numerics/BothInt8.cs @@ -14,13 +14,6 @@ namespace SabreTools.IO.Numerics return new BothInt8(le, be); } - public static BothInt8 operator +(BothInt8 a, sbyte b) - { - sbyte le = (sbyte)(a.LittleEndian + b); - sbyte be = (sbyte)(a.BigEndian + b); - return new BothInt8(le, be); - } - public static BothInt8 operator -(BothInt8 a, BothInt8 b) { sbyte le = (sbyte)(a.LittleEndian - b.LittleEndian); @@ -28,13 +21,6 @@ namespace SabreTools.IO.Numerics return new BothInt8(le, be); } - public static BothInt8 operator -(BothInt8 a, sbyte b) - { - sbyte le = (sbyte)(a.LittleEndian - b); - sbyte be = (sbyte)(a.BigEndian - b); - return new BothInt8(le, be); - } - public static BothInt8 operator *(BothInt8 a, BothInt8 b) { sbyte le = (sbyte)(a.LittleEndian * b.LittleEndian); @@ -42,13 +28,6 @@ namespace SabreTools.IO.Numerics return new BothInt8(le, be); } - public static BothInt8 operator *(BothInt8 a, sbyte b) - { - sbyte le = (sbyte)(a.LittleEndian * b); - sbyte be = (sbyte)(a.BigEndian * b); - return new BothInt8(le, be); - } - public static BothInt8 operator /(BothInt8 a, BothInt8 b) { sbyte le = (sbyte)(a.LittleEndian / b.LittleEndian); @@ -56,13 +35,6 @@ namespace SabreTools.IO.Numerics return new BothInt8(le, be); } - public static BothInt8 operator /(BothInt8 a, sbyte b) - { - sbyte le = (sbyte)(a.LittleEndian / b); - sbyte be = (sbyte)(a.BigEndian / b); - return new BothInt8(le, be); - } - public static BothInt8 operator ^(BothInt8 a, BothInt8 b) { sbyte le = (sbyte)(a.LittleEndian ^ b.LittleEndian); @@ -70,13 +42,6 @@ namespace SabreTools.IO.Numerics return new BothInt8(le, be); } - public static BothInt8 operator ^(BothInt8 a, sbyte b) - { - sbyte le = (sbyte)(a.LittleEndian ^ b); - sbyte be = (sbyte)(a.BigEndian ^ b); - return new BothInt8(le, be); - } - public static implicit operator BothInt8(sbyte val) => new(val, val); diff --git a/SabreTools.IO/Numerics/BothUInt16.cs b/SabreTools.IO/Numerics/BothUInt16.cs index 5415c83..a19081b 100644 --- a/SabreTools.IO/Numerics/BothUInt16.cs +++ b/SabreTools.IO/Numerics/BothUInt16.cs @@ -14,13 +14,6 @@ namespace SabreTools.IO.Numerics return new BothUInt16(le, be); } - public static BothUInt16 operator +(BothUInt16 a, ushort b) - { - ushort le = (ushort)(a.LittleEndian + b); - ushort be = (ushort)(a.BigEndian + b); - return new BothUInt16(le, be); - } - public static BothUInt16 operator -(BothUInt16 a, BothUInt16 b) { ushort le = (ushort)(a.LittleEndian - b.LittleEndian); @@ -28,13 +21,6 @@ namespace SabreTools.IO.Numerics return new BothUInt16(le, be); } - public static BothUInt16 operator -(BothUInt16 a, ushort b) - { - ushort le = (ushort)(a.LittleEndian - b); - ushort be = (ushort)(a.BigEndian - b); - return new BothUInt16(le, be); - } - public static BothUInt16 operator *(BothUInt16 a, BothUInt16 b) { ushort le = (ushort)(a.LittleEndian * b.LittleEndian); @@ -42,13 +28,6 @@ namespace SabreTools.IO.Numerics return new BothUInt16(le, be); } - public static BothUInt16 operator *(BothUInt16 a, ushort b) - { - ushort le = (ushort)(a.LittleEndian * b); - ushort be = (ushort)(a.BigEndian * b); - return new BothUInt16(le, be); - } - public static BothUInt16 operator /(BothUInt16 a, BothUInt16 b) { ushort le = (ushort)(a.LittleEndian / b.LittleEndian); @@ -56,13 +35,6 @@ namespace SabreTools.IO.Numerics return new BothUInt16(le, be); } - public static BothUInt16 operator /(BothUInt16 a, ushort b) - { - ushort le = (ushort)(a.LittleEndian / b); - ushort be = (ushort)(a.BigEndian / b); - return new BothUInt16(le, be); - } - public static BothUInt16 operator ^(BothUInt16 a, BothUInt16 b) { ushort le = (ushort)(a.LittleEndian ^ b.LittleEndian); @@ -70,13 +42,6 @@ namespace SabreTools.IO.Numerics return new BothUInt16(le, be); } - public static BothUInt16 operator ^(BothUInt16 a, ushort b) - { - ushort le = (ushort)(a.LittleEndian ^ b); - ushort be = (ushort)(a.BigEndian ^ b); - return new BothUInt16(le, be); - } - public static implicit operator BothUInt16(ushort val) => new(val, val); diff --git a/SabreTools.IO/Numerics/BothUInt32.cs b/SabreTools.IO/Numerics/BothUInt32.cs index fc1e1d7..8fddda8 100644 --- a/SabreTools.IO/Numerics/BothUInt32.cs +++ b/SabreTools.IO/Numerics/BothUInt32.cs @@ -14,13 +14,6 @@ namespace SabreTools.IO.Numerics return new BothUInt32(le, be); } - public static BothUInt32 operator +(BothUInt32 a, uint b) - { - uint le = (uint)(a.LittleEndian + b); - uint be = (uint)(a.BigEndian + b); - return new BothUInt32(le, be); - } - public static BothUInt32 operator -(BothUInt32 a, BothUInt32 b) { uint le = (uint)(a.LittleEndian - b.LittleEndian); @@ -28,13 +21,6 @@ namespace SabreTools.IO.Numerics return new BothUInt32(le, be); } - public static BothUInt32 operator -(BothUInt32 a, uint b) - { - uint le = (uint)(a.LittleEndian - b); - uint be = (uint)(a.BigEndian - b); - return new BothUInt32(le, be); - } - public static BothUInt32 operator *(BothUInt32 a, BothUInt32 b) { uint le = (uint)(a.LittleEndian * b.LittleEndian); @@ -42,13 +28,6 @@ namespace SabreTools.IO.Numerics return new BothUInt32(le, be); } - public static BothUInt32 operator *(BothUInt32 a, uint b) - { - uint le = (uint)(a.LittleEndian * b); - uint be = (uint)(a.BigEndian * b); - return new BothUInt32(le, be); - } - public static BothUInt32 operator /(BothUInt32 a, BothUInt32 b) { uint le = (uint)(a.LittleEndian / b.LittleEndian); @@ -56,24 +35,10 @@ namespace SabreTools.IO.Numerics return new BothUInt32(le, be); } - public static BothUInt32 operator /(BothUInt32 a, uint b) - { - uint le = (uint)(a.LittleEndian / b); - uint be = (uint)(a.BigEndian / b); - return new BothUInt32(le, be); - } - public static BothUInt32 operator ^(BothUInt32 a, BothUInt32 b) { - uint le = (uint)(a.LittleEndian ^ b); - uint be = (uint)(a.BigEndian ^ b); - return new BothUInt32(le, be); - } - - public static BothUInt32 operator ^(BothUInt32 a, uint b) - { - uint le = (uint)(a.LittleEndian ^ b); - uint be = (uint)(a.BigEndian ^ b); + uint le = (uint)(a.LittleEndian ^ b.LittleEndian); + uint be = (uint)(a.BigEndian ^ b.BigEndian); return new BothUInt32(le, be); } diff --git a/SabreTools.IO/Numerics/BothUInt64.cs b/SabreTools.IO/Numerics/BothUInt64.cs index b7b3faf..f154354 100644 --- a/SabreTools.IO/Numerics/BothUInt64.cs +++ b/SabreTools.IO/Numerics/BothUInt64.cs @@ -14,13 +14,6 @@ namespace SabreTools.IO.Numerics return new BothUInt64(le, be); } - public static BothUInt64 operator +(BothUInt64 a, ulong b) - { - ulong le = (ulong)(a.LittleEndian + b); - ulong be = (ulong)(a.BigEndian + b); - return new BothUInt64(le, be); - } - public static BothUInt64 operator -(BothUInt64 a, BothUInt64 b) { ulong le = (ulong)(a.LittleEndian - b.LittleEndian); @@ -28,13 +21,6 @@ namespace SabreTools.IO.Numerics return new BothUInt64(le, be); } - public static BothUInt64 operator -(BothUInt64 a, ulong b) - { - ulong le = (ulong)(a.LittleEndian - b); - ulong be = (ulong)(a.BigEndian - b); - return new BothUInt64(le, be); - } - public static BothUInt64 operator *(BothUInt64 a, BothUInt64 b) { ulong le = (ulong)(a.LittleEndian * b.LittleEndian); @@ -42,13 +28,6 @@ namespace SabreTools.IO.Numerics return new BothUInt64(le, be); } - public static BothUInt64 operator *(BothUInt64 a, ulong b) - { - ulong le = (ulong)(a.LittleEndian * b); - ulong be = (ulong)(a.BigEndian * b); - return new BothUInt64(le, be); - } - public static BothUInt64 operator /(BothUInt64 a, BothUInt64 b) { ulong le = (ulong)(a.LittleEndian / b.LittleEndian); @@ -56,13 +35,6 @@ namespace SabreTools.IO.Numerics return new BothUInt64(le, be); } - public static BothUInt64 operator /(BothUInt64 a, ulong b) - { - ulong le = (ulong)(a.LittleEndian / b); - ulong be = (ulong)(a.BigEndian / b); - return new BothUInt64(le, be); - } - public static BothUInt64 operator ^(BothUInt64 a, BothUInt64 b) { ulong le = (ulong)(a.LittleEndian ^ b.LittleEndian); @@ -70,13 +42,6 @@ namespace SabreTools.IO.Numerics return new BothUInt64(le, be); } - public static BothUInt64 operator ^(BothUInt64 a, ulong b) - { - ulong le = (ulong)(a.LittleEndian ^ b); - ulong be = (ulong)(a.BigEndian ^ b); - return new BothUInt64(le, be); - } - public static implicit operator BothUInt64(ulong val) => new(val, val); diff --git a/SabreTools.IO/Numerics/BothUInt8.cs b/SabreTools.IO/Numerics/BothUInt8.cs index da59efd..ab3bb0c 100644 --- a/SabreTools.IO/Numerics/BothUInt8.cs +++ b/SabreTools.IO/Numerics/BothUInt8.cs @@ -14,13 +14,6 @@ namespace SabreTools.IO.Numerics return new BothUInt8(le, be); } - public static BothUInt8 operator +(BothUInt8 a, byte b) - { - byte le = (byte)(a.LittleEndian + b); - byte be = (byte)(a.BigEndian + b); - return new BothUInt8(le, be); - } - public static BothUInt8 operator -(BothUInt8 a, BothUInt8 b) { byte le = (byte)(a.LittleEndian - b.LittleEndian); @@ -28,13 +21,6 @@ namespace SabreTools.IO.Numerics return new BothUInt8(le, be); } - public static BothUInt8 operator -(BothUInt8 a, byte b) - { - byte le = (byte)(a.LittleEndian - b); - byte be = (byte)(a.BigEndian - b); - return new BothUInt8(le, be); - } - public static BothUInt8 operator *(BothUInt8 a, BothUInt8 b) { byte le = (byte)(a.LittleEndian * b.LittleEndian); @@ -42,13 +28,6 @@ namespace SabreTools.IO.Numerics return new BothUInt8(le, be); } - public static BothUInt8 operator *(BothUInt8 a, byte b) - { - byte le = (byte)(a.LittleEndian * b); - byte be = (byte)(a.BigEndian * b); - return new BothUInt8(le, be); - } - public static BothUInt8 operator /(BothUInt8 a, BothUInt8 b) { byte le = (byte)(a.LittleEndian / b.LittleEndian); @@ -56,13 +35,6 @@ namespace SabreTools.IO.Numerics return new BothUInt8(le, be); } - public static BothUInt8 operator /(BothUInt8 a, byte b) - { - byte le = (byte)(a.LittleEndian / b); - byte be = (byte)(a.BigEndian / b); - return new BothUInt8(le, be); - } - public static BothUInt8 operator ^(BothUInt8 a, BothUInt8 b) { byte le = (byte)(a.LittleEndian ^ b.LittleEndian); @@ -70,13 +42,6 @@ namespace SabreTools.IO.Numerics return new BothUInt8(le, be); } - public static BothUInt8 operator ^(BothUInt8 a, byte b) - { - byte le = (byte)(a.LittleEndian ^ b); - byte be = (byte)(a.BigEndian ^ b); - return new BothUInt8(le, be); - } - public static implicit operator BothUInt8(byte val) => new(val, val);