Jsm.File.Operation.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Runtime.InteropServices;
  2. #pragma warning disable 649 // field is never assigned
  3. namespace OpenVIII.Fields.Scripts
  4. {
  5. public static partial class Jsm
  6. {
  7. public static partial class File
  8. {
  9. [StructLayout(LayoutKind.Explicit,Size = 4,Pack = 1)]
  10. public struct Operation
  11. {
  12. [field:FieldOffset(0)]
  13. private readonly int _value;
  14. public Opcode Opcode
  15. {
  16. get
  17. {
  18. if ((_value & 0x_FF00_0000) != 0)
  19. return (Opcode)(_value >> 24);
  20. return (Opcode)_value;
  21. }
  22. }
  23. public int Parameter
  24. {
  25. get
  26. {
  27. if ((_value & 0x_0080_0000) == 0)
  28. return _value & 0x_00FF_FFFF;
  29. return (int)(_value | 0x_FF00_0000);
  30. }
  31. }
  32. }
  33. }
  34. }
  35. }