diff --git a/src/Math/Fixed/Fix64.cs b/src/Math/Fixed/Fix64.cs index 44b4712..310d43d 100644 --- a/src/Math/Fixed/Fix64.cs +++ b/src/Math/Fixed/Fix64.cs @@ -531,6 +531,16 @@ namespace MoonWorks.Math.Fixed return new Fix64(sum); } + public static Fix64 operator +(Fix64 x, int y) + { + return x + new Fix64(y); + } + + public static Fix64 operator +(int x, Fix64 y) + { + return new Fix64(x) + y; + } + public static Fix64 operator -(Fix64 x, Fix64 y) { var xl = x.RawValue; @@ -544,6 +554,16 @@ namespace MoonWorks.Math.Fixed return new Fix64(diff); } + public static Fix64 operator -(Fix64 x, int y) + { + return x - new Fix64(y); + } + + public static Fix64 operator -(int x, Fix64 y) + { + return new Fix64(x) - y; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private static Fix64 FastSub(Fix64 x, Fix64 y) { @@ -668,6 +688,16 @@ namespace MoonWorks.Math.Fixed return result; } + public static Fix64 operator *(Fix64 x, int y) + { + return x * new Fix64(y); + } + + public static Fix64 operator *(int x, Fix64 y) + { + return new Fix64(x) * y; + } + public static Fix64 operator /(Fix64 x, Fix64 y) { var xl = x.RawValue; @@ -726,6 +756,16 @@ namespace MoonWorks.Math.Fixed return new Fix64(result); } + public static Fix64 operator /(Fix64 x, int y) + { + return x / new Fix64(y); + } + + public static Fix64 operator /(int x, Fix64 y) + { + return new Fix64(x) / y; + } + public static Fix64 operator %(Fix64 x, Fix64 y) { return new Fix64( @@ -734,6 +774,16 @@ namespace MoonWorks.Math.Fixed x.RawValue % y.RawValue); } + public static Fix64 operator %(Fix64 x, int y) + { + return x % new Fix64(y); + } + + public static Fix64 operator %(int x, Fix64 y) + { + return new Fix64(x) % y; + } + public static Fix64 operator -(Fix64 x) { return x.RawValue == MIN_VALUE ? MaxValue : new Fix64(-x.RawValue);