Skip to content

Commit 70b78f8

Browse files
committed
Revert "Add base type operator support to both-endian"
This reverts commit 5b306ce.
1 parent 5b306ce commit 70b78f8

File tree

8 files changed

+2
-282
lines changed

8 files changed

+2
-282
lines changed

SabreTools.IO/Numerics/BothInt16.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,69 +14,34 @@ public sealed class BothInt16(short le, short be) : BothEndian<short>(le, be)
1414
return new BothInt16(le, be);
1515
}
1616

17-
public static BothInt16 operator +(BothInt16 a, short b)
18-
{
19-
short le = (short)(a.LittleEndian + b);
20-
short be = (short)(a.BigEndian + b);
21-
return new BothInt16(le, be);
22-
}
23-
2417
public static BothInt16 operator -(BothInt16 a, BothInt16 b)
2518
{
2619
short le = (short)(a.LittleEndian - b.LittleEndian);
2720
short be = (short)(a.BigEndian - b.BigEndian);
2821
return new BothInt16(le, be);
2922
}
3023

31-
public static BothInt16 operator -(BothInt16 a, short b)
32-
{
33-
short le = (short)(a.LittleEndian - b);
34-
short be = (short)(a.BigEndian - b);
35-
return new BothInt16(le, be);
36-
}
37-
3824
public static BothInt16 operator *(BothInt16 a, BothInt16 b)
3925
{
4026
short le = (short)(a.LittleEndian * b.LittleEndian);
4127
short be = (short)(a.BigEndian * b.BigEndian);
4228
return new BothInt16(le, be);
4329
}
4430

45-
public static BothInt16 operator *(BothInt16 a, short b)
46-
{
47-
short le = (short)(a.LittleEndian * b);
48-
short be = (short)(a.BigEndian * b);
49-
return new BothInt16(le, be);
50-
}
51-
5231
public static BothInt16 operator /(BothInt16 a, BothInt16 b)
5332
{
5433
short le = (short)(a.LittleEndian / b.LittleEndian);
5534
short be = (short)(a.BigEndian / b.BigEndian);
5635
return new BothInt16(le, be);
5736
}
5837

59-
public static BothInt16 operator /(BothInt16 a, short b)
60-
{
61-
short le = (short)(a.LittleEndian / b);
62-
short be = (short)(a.BigEndian / b);
63-
return new BothInt16(le, be);
64-
}
65-
6638
public static BothInt16 operator ^(BothInt16 a, BothInt16 b)
6739
{
6840
short le = (short)(a.LittleEndian ^ b.LittleEndian);
6941
short be = (short)(a.BigEndian ^ b.BigEndian);
7042
return new BothInt16(le, be);
7143
}
7244

73-
public static BothInt16 operator ^(BothInt16 a, short b)
74-
{
75-
short le = (short)(a.LittleEndian ^ b);
76-
short be = (short)(a.BigEndian ^ b);
77-
return new BothInt16(le, be);
78-
}
79-
8045
public static implicit operator BothInt16(short val)
8146
=> new(val, val);
8247

SabreTools.IO/Numerics/BothInt32.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,69 +14,34 @@ public sealed class BothInt32(int le, int be) : BothEndian<int>(le, be)
1414
return new BothInt32(le, be);
1515
}
1616

17-
public static BothInt32 operator +(BothInt32 a, int b)
18-
{
19-
int le = (int)(a.LittleEndian + b);
20-
int be = (int)(a.BigEndian + b);
21-
return new BothInt32(le, be);
22-
}
23-
2417
public static BothInt32 operator -(BothInt32 a, BothInt32 b)
2518
{
2619
int le = (int)(a.LittleEndian - b.LittleEndian);
2720
int be = (int)(a.BigEndian - b.BigEndian);
2821
return new BothInt32(le, be);
2922
}
3023

31-
public static BothInt32 operator -(BothInt32 a, int b)
32-
{
33-
int le = (int)(a.LittleEndian - b);
34-
int be = (int)(a.BigEndian - b);
35-
return new BothInt32(le, be);
36-
}
37-
3824
public static BothInt32 operator *(BothInt32 a, BothInt32 b)
3925
{
4026
int le = (int)(a.LittleEndian * b.LittleEndian);
4127
int be = (int)(a.BigEndian * b.BigEndian);
4228
return new BothInt32(le, be);
4329
}
4430

45-
public static BothInt32 operator *(BothInt32 a, int b)
46-
{
47-
int le = (int)(a.LittleEndian * b);
48-
int be = (int)(a.BigEndian * b);
49-
return new BothInt32(le, be);
50-
}
51-
5231
public static BothInt32 operator /(BothInt32 a, BothInt32 b)
5332
{
5433
int le = (int)(a.LittleEndian / b.LittleEndian);
5534
int be = (int)(a.BigEndian / b.BigEndian);
5635
return new BothInt32(le, be);
5736
}
5837

59-
public static BothInt32 operator /(BothInt32 a, int b)
60-
{
61-
int le = (int)(a.LittleEndian / b);
62-
int be = (int)(a.BigEndian / b);
63-
return new BothInt32(le, be);
64-
}
65-
6638
public static BothInt32 operator ^(BothInt32 a, BothInt32 b)
6739
{
6840
int le = (int)(a.LittleEndian ^ b.LittleEndian);
6941
int be = (int)(a.BigEndian ^ b.BigEndian);
7042
return new BothInt32(le, be);
7143
}
7244

73-
public static BothInt32 operator ^(BothInt32 a, int b)
74-
{
75-
int le = (int)(a.LittleEndian ^ b);
76-
int be = (int)(a.BigEndian ^ b);
77-
return new BothInt32(le, be);
78-
}
79-
8045
public static implicit operator BothInt32(int val)
8146
=> new(val, val);
8247

SabreTools.IO/Numerics/BothInt64.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,69 +14,34 @@ public sealed class BothInt64(long le, long be) : BothEndian<long>(le, be)
1414
return new BothInt64(le, be);
1515
}
1616

17-
public static BothInt64 operator +(BothInt64 a, long b)
18-
{
19-
long le = (long)(a.LittleEndian + b);
20-
long be = (long)(a.BigEndian + b);
21-
return new BothInt64(le, be);
22-
}
23-
2417
public static BothInt64 operator -(BothInt64 a, BothInt64 b)
2518
{
2619
long le = (long)(a.LittleEndian - b.LittleEndian);
2720
long be = (long)(a.BigEndian - b.BigEndian);
2821
return new BothInt64(le, be);
2922
}
3023

31-
public static BothInt64 operator -(BothInt64 a, long b)
32-
{
33-
long le = (long)(a.LittleEndian - b);
34-
long be = (long)(a.BigEndian - b);
35-
return new BothInt64(le, be);
36-
}
37-
3824
public static BothInt64 operator *(BothInt64 a, BothInt64 b)
3925
{
4026
long le = (long)(a.LittleEndian * b.LittleEndian);
4127
long be = (long)(a.BigEndian * b.BigEndian);
4228
return new BothInt64(le, be);
4329
}
4430

45-
public static BothInt64 operator *(BothInt64 a, long b)
46-
{
47-
long le = (long)(a.LittleEndian * b);
48-
long be = (long)(a.BigEndian * b);
49-
return new BothInt64(le, be);
50-
}
51-
5231
public static BothInt64 operator /(BothInt64 a, BothInt64 b)
5332
{
5433
long le = (long)(a.LittleEndian / b.LittleEndian);
5534
long be = (long)(a.BigEndian / b.BigEndian);
5635
return new BothInt64(le, be);
5736
}
5837

59-
public static BothInt64 operator /(BothInt64 a, long b)
60-
{
61-
long le = (long)(a.LittleEndian / b);
62-
long be = (long)(a.BigEndian / b);
63-
return new BothInt64(le, be);
64-
}
65-
6638
public static BothInt64 operator ^(BothInt64 a, BothInt64 b)
6739
{
6840
long le = (long)(a.LittleEndian ^ b.LittleEndian);
6941
long be = (long)(a.BigEndian ^ b.BigEndian);
7042
return new BothInt64(le, be);
7143
}
7244

73-
public static BothInt64 operator ^(BothInt64 a, long b)
74-
{
75-
long le = (long)(a.LittleEndian ^ b);
76-
long be = (long)(a.BigEndian ^ b);
77-
return new BothInt64(le, be);
78-
}
79-
8045
public static implicit operator BothInt64(long val)
8146
=> new(val, val);
8247

SabreTools.IO/Numerics/BothInt8.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,69 +14,34 @@ public sealed class BothInt8(sbyte le, sbyte be) : BothEndian<sbyte>(le, be)
1414
return new BothInt8(le, be);
1515
}
1616

17-
public static BothInt8 operator +(BothInt8 a, sbyte b)
18-
{
19-
sbyte le = (sbyte)(a.LittleEndian + b);
20-
sbyte be = (sbyte)(a.BigEndian + b);
21-
return new BothInt8(le, be);
22-
}
23-
2417
public static BothInt8 operator -(BothInt8 a, BothInt8 b)
2518
{
2619
sbyte le = (sbyte)(a.LittleEndian - b.LittleEndian);
2720
sbyte be = (sbyte)(a.BigEndian - b.BigEndian);
2821
return new BothInt8(le, be);
2922
}
3023

31-
public static BothInt8 operator -(BothInt8 a, sbyte b)
32-
{
33-
sbyte le = (sbyte)(a.LittleEndian - b);
34-
sbyte be = (sbyte)(a.BigEndian - b);
35-
return new BothInt8(le, be);
36-
}
37-
3824
public static BothInt8 operator *(BothInt8 a, BothInt8 b)
3925
{
4026
sbyte le = (sbyte)(a.LittleEndian * b.LittleEndian);
4127
sbyte be = (sbyte)(a.BigEndian * b.BigEndian);
4228
return new BothInt8(le, be);
4329
}
4430

45-
public static BothInt8 operator *(BothInt8 a, sbyte b)
46-
{
47-
sbyte le = (sbyte)(a.LittleEndian * b);
48-
sbyte be = (sbyte)(a.BigEndian * b);
49-
return new BothInt8(le, be);
50-
}
51-
5231
public static BothInt8 operator /(BothInt8 a, BothInt8 b)
5332
{
5433
sbyte le = (sbyte)(a.LittleEndian / b.LittleEndian);
5534
sbyte be = (sbyte)(a.BigEndian / b.BigEndian);
5635
return new BothInt8(le, be);
5736
}
5837

59-
public static BothInt8 operator /(BothInt8 a, sbyte b)
60-
{
61-
sbyte le = (sbyte)(a.LittleEndian / b);
62-
sbyte be = (sbyte)(a.BigEndian / b);
63-
return new BothInt8(le, be);
64-
}
65-
6638
public static BothInt8 operator ^(BothInt8 a, BothInt8 b)
6739
{
6840
sbyte le = (sbyte)(a.LittleEndian ^ b.LittleEndian);
6941
sbyte be = (sbyte)(a.BigEndian ^ b.BigEndian);
7042
return new BothInt8(le, be);
7143
}
7244

73-
public static BothInt8 operator ^(BothInt8 a, sbyte b)
74-
{
75-
sbyte le = (sbyte)(a.LittleEndian ^ b);
76-
sbyte be = (sbyte)(a.BigEndian ^ b);
77-
return new BothInt8(le, be);
78-
}
79-
8045
public static implicit operator BothInt8(sbyte val)
8146
=> new(val, val);
8247

SabreTools.IO/Numerics/BothUInt16.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,69 +14,34 @@ public sealed class BothUInt16(ushort le, ushort be) : BothEndian<ushort>(le, be
1414
return new BothUInt16(le, be);
1515
}
1616

17-
public static BothUInt16 operator +(BothUInt16 a, ushort b)
18-
{
19-
ushort le = (ushort)(a.LittleEndian + b);
20-
ushort be = (ushort)(a.BigEndian + b);
21-
return new BothUInt16(le, be);
22-
}
23-
2417
public static BothUInt16 operator -(BothUInt16 a, BothUInt16 b)
2518
{
2619
ushort le = (ushort)(a.LittleEndian - b.LittleEndian);
2720
ushort be = (ushort)(a.BigEndian - b.BigEndian);
2821
return new BothUInt16(le, be);
2922
}
3023

31-
public static BothUInt16 operator -(BothUInt16 a, ushort b)
32-
{
33-
ushort le = (ushort)(a.LittleEndian - b);
34-
ushort be = (ushort)(a.BigEndian - b);
35-
return new BothUInt16(le, be);
36-
}
37-
3824
public static BothUInt16 operator *(BothUInt16 a, BothUInt16 b)
3925
{
4026
ushort le = (ushort)(a.LittleEndian * b.LittleEndian);
4127
ushort be = (ushort)(a.BigEndian * b.BigEndian);
4228
return new BothUInt16(le, be);
4329
}
4430

45-
public static BothUInt16 operator *(BothUInt16 a, ushort b)
46-
{
47-
ushort le = (ushort)(a.LittleEndian * b);
48-
ushort be = (ushort)(a.BigEndian * b);
49-
return new BothUInt16(le, be);
50-
}
51-
5231
public static BothUInt16 operator /(BothUInt16 a, BothUInt16 b)
5332
{
5433
ushort le = (ushort)(a.LittleEndian / b.LittleEndian);
5534
ushort be = (ushort)(a.BigEndian / b.BigEndian);
5635
return new BothUInt16(le, be);
5736
}
5837

59-
public static BothUInt16 operator /(BothUInt16 a, ushort b)
60-
{
61-
ushort le = (ushort)(a.LittleEndian / b);
62-
ushort be = (ushort)(a.BigEndian / b);
63-
return new BothUInt16(le, be);
64-
}
65-
6638
public static BothUInt16 operator ^(BothUInt16 a, BothUInt16 b)
6739
{
6840
ushort le = (ushort)(a.LittleEndian ^ b.LittleEndian);
6941
ushort be = (ushort)(a.BigEndian ^ b.BigEndian);
7042
return new BothUInt16(le, be);
7143
}
7244

73-
public static BothUInt16 operator ^(BothUInt16 a, ushort b)
74-
{
75-
ushort le = (ushort)(a.LittleEndian ^ b);
76-
ushort be = (ushort)(a.BigEndian ^ b);
77-
return new BothUInt16(le, be);
78-
}
79-
8045
public static implicit operator BothUInt16(ushort val)
8146
=> new(val, val);
8247

0 commit comments

Comments
 (0)