IntegerOptions.cs 950 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. namespace LitMotion
  3. {
  4. /// <summary>
  5. /// Options for integer type motion.
  6. /// </summary>
  7. public struct IntegerOptions : IMotionOptions, IEquatable<IntegerOptions>
  8. {
  9. public RoundingMode RoundingMode;
  10. public readonly bool Equals(IntegerOptions other)
  11. {
  12. return other.RoundingMode == RoundingMode;
  13. }
  14. public override readonly bool Equals(object obj)
  15. {
  16. if (obj is IntegerOptions integerOptions) return Equals(integerOptions);
  17. return false;
  18. }
  19. public override readonly int GetHashCode()
  20. {
  21. return (int)RoundingMode;
  22. }
  23. }
  24. /// <summary>
  25. /// Specifies the rounding format for values after the decimal point.
  26. /// </summary>
  27. public enum RoundingMode : byte
  28. {
  29. ToEven,
  30. AwayFromZero,
  31. ToZero,
  32. ToPositiveInfinity,
  33. ToNegativeInfinity
  34. }
  35. }