Corrected operators for uchar to use the internal type for operations, defined int8_t compat type

This commit is contained in:
Samuele Lorefice
2025-01-22 16:29:54 +01:00
parent 0a51b6e052
commit d5533ac251
2 changed files with 43 additions and 12 deletions

View File

@@ -19,16 +19,16 @@ public readonly struct uchar {
public static explicit operator int(uchar value) => value._value;
public static implicit operator uchar(int value) => new((byte)value);
public static uchar operator +(uchar left, uchar right) => left.Value + right.Value;
public static uchar operator -(uchar left, uchar right) => left.Value - right.Value;
public static uchar operator *(uchar left, uchar right) => left.Value * right.Value;
public static uchar operator /(uchar left, uchar right) => left.Value / right.Value;
public static uchar operator %(uchar left, uchar right) => left.Value % right.Value;
public static uchar operator &(uchar left, uchar right) => left.Value & right.Value;
public static uchar operator |(uchar left, uchar right) => left.Value | right.Value;
public static uchar operator ^(uchar left, uchar right) => left.Value ^ right.Value;
public static uchar operator <<(uchar left, byte right) => left.Value << right;
public static uchar operator >>(uchar left, byte right) => left.Value >> right;
public static uchar operator ++(uchar value) => new (value.Value + 1);
public static uchar operator --(uchar value) => new (value.Value - 1);
public static uchar operator +(uchar left, uchar right) => left._value + right._value;
public static uchar operator -(uchar left, uchar right) => left._value - right._value;
public static uchar operator *(uchar left, uchar right) => left._value * right._value;
public static uchar operator /(uchar left, uchar right) => left._value / right._value;
public static uchar operator %(uchar left, uchar right) => left._value % right._value;
public static uchar operator &(uchar left, uchar right) => left._value & right._value;
public static uchar operator |(uchar left, uchar right) => left._value | right._value;
public static uchar operator ^(uchar left, uchar right) => left._value ^ right._value;
public static uchar operator <<(uchar left, byte right) => left._value << right;
public static uchar operator >>(uchar left, byte right) => left._value >> right;
public static uchar operator ++(uchar value) => new (value._value + 1);
public static uchar operator --(uchar value) => new (value._value - 1);
}