@@ -252,14 +252,30 @@ public static explicit operator decimal(Fixed64 value)
252
252
}
253
253
254
254
/// <summary>
255
- /// Adds an int to y
255
+ /// Adds an Fixed64 to x
256
256
/// </summary>
257
257
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
258
258
public static Fixed64 operator + ( int x , Fixed64 y )
259
259
{
260
260
return y + x ;
261
261
}
262
262
263
+ /// <summary>
264
+ /// Adds a float to x
265
+ /// </summary>
266
+ public static Fixed64 operator + ( Fixed64 x , float y )
267
+ {
268
+ return new Fixed64 ( ( x . m_rawValue * FixedMath . SCALE_FACTOR_D ) + y ) ;
269
+ }
270
+
271
+ /// <summary>
272
+ /// Adds a Fixed64 to x
273
+ /// </summary>
274
+ public static Fixed64 operator + ( float x , Fixed64 y )
275
+ {
276
+ return y + x ;
277
+ }
278
+
263
279
/// <summary>
264
280
/// Subtracts one Fixed64 number from another, with saturating behavior in case of overflow.
265
281
/// </summary>
@@ -284,12 +300,30 @@ public static explicit operator decimal(Fixed64 value)
284
300
}
285
301
286
302
/// <summary>
287
- /// Subtracts an int from y
303
+ /// Subtracts a Fixed64 from x
288
304
/// </summary>
289
305
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
290
306
public static Fixed64 operator - ( int x , Fixed64 y )
291
307
{
292
- return y - x ;
308
+ return new Fixed64 ( x - ( y . m_rawValue * FixedMath . SCALE_FACTOR_D ) ) ;
309
+ }
310
+
311
+ /// <summary>
312
+ /// Subtracts a float from x
313
+ /// </summary>
314
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
315
+ public static Fixed64 operator - ( Fixed64 x , float y )
316
+ {
317
+ return new Fixed64 ( ( x . m_rawValue * FixedMath . SCALE_FACTOR_D ) - y ) ;
318
+ }
319
+
320
+ /// <summary>
321
+ /// Subtracts a Fixed64 from x
322
+ /// </summary>
323
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
324
+ public static Fixed64 operator - ( float x , Fixed64 y )
325
+ {
326
+ return new Fixed64 ( x - ( y . m_rawValue * FixedMath . SCALE_FACTOR_D ) ) ;
293
327
}
294
328
295
329
/// <summary>
0 commit comments