diff --git a/src/core/overflowsafe_type.hpp b/src/core/overflowsafe_type.hpp index 8f1f404a7b..882363f1b7 100644 --- a/src/core/overflowsafe_type.hpp +++ b/src/core/overflowsafe_type.hpp @@ -139,9 +139,9 @@ template FORCEINLINE OverflowSafeInt FORCEINLINE OverflowSafeInt operator / (uint a, OverflowSafeInt b) { return (OverflowSafeInt)a / (int)b; } /* Sometimes we got byte operator OverflowSafeInt instead of vice versa. Handle that properly */ -template FORCEINLINE OverflowSafeInt operator + (byte a, OverflowSafeInt b) { return b + a; } -template FORCEINLINE OverflowSafeInt operator - (byte a, OverflowSafeInt b) { return -b + a; } -template FORCEINLINE OverflowSafeInt operator * (byte a, OverflowSafeInt b) { return b * a; } +template FORCEINLINE OverflowSafeInt operator + (byte a, OverflowSafeInt b) { return b + (uint)a; } +template FORCEINLINE OverflowSafeInt operator - (byte a, OverflowSafeInt b) { return -b + (uint)a; } +template FORCEINLINE OverflowSafeInt operator * (byte a, OverflowSafeInt b) { return b * (uint)a; } template FORCEINLINE OverflowSafeInt operator / (byte a, OverflowSafeInt b) { return (OverflowSafeInt)a / (int)b; } typedef OverflowSafeInt OverflowSafeInt64;