您最多选择25个标签 标签必须以中文、字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LLamaSeqId.cs 885 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Runtime.InteropServices;
  2. namespace LLama.Native;
  3. /// <summary>
  4. /// ID for a sequence in a batch
  5. /// </summary>
  6. [StructLayout(LayoutKind.Sequential)]
  7. public struct LLamaSeqId
  8. {
  9. /// <summary>
  10. /// The raw value
  11. /// </summary>
  12. public int Value;
  13. /// <summary>
  14. /// Create a new LLamaSeqId
  15. /// </summary>
  16. /// <param name="value"></param>
  17. public LLamaSeqId(int value)
  18. {
  19. Value = value;
  20. }
  21. /// <summary>
  22. /// Convert a LLamaSeqId into an integer (extract the raw value)
  23. /// </summary>
  24. /// <param name="pos"></param>
  25. public static explicit operator int(LLamaSeqId pos) => pos.Value;
  26. /// <summary>
  27. /// Convert an integer into a LLamaSeqId
  28. /// </summary>
  29. /// <param name="value"></param>
  30. /// <returns></returns>
  31. public static explicit operator LLamaSeqId(int value) => new(value);
  32. }