You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
1.4 KiB

  1. package codes
  2. type Code byte
  3. var (
  4. PosFixedNumHigh Code = 0x7f
  5. NegFixedNumLow Code = 0xe0
  6. Nil Code = 0xc0
  7. False Code = 0xc2
  8. True Code = 0xc3
  9. Float Code = 0xca
  10. Double Code = 0xcb
  11. Uint8 Code = 0xcc
  12. Uint16 Code = 0xcd
  13. Uint32 Code = 0xce
  14. Uint64 Code = 0xcf
  15. Int8 Code = 0xd0
  16. Int16 Code = 0xd1
  17. Int32 Code = 0xd2
  18. Int64 Code = 0xd3
  19. FixedStrLow Code = 0xa0
  20. FixedStrHigh Code = 0xbf
  21. FixedStrMask Code = 0x1f
  22. Str8 Code = 0xd9
  23. Str16 Code = 0xda
  24. Str32 Code = 0xdb
  25. Bin8 Code = 0xc4
  26. Bin16 Code = 0xc5
  27. Bin32 Code = 0xc6
  28. FixedArrayLow Code = 0x90
  29. FixedArrayHigh Code = 0x9f
  30. FixedArrayMask Code = 0xf
  31. Array16 Code = 0xdc
  32. Array32 Code = 0xdd
  33. FixedMapLow Code = 0x80
  34. FixedMapHigh Code = 0x8f
  35. FixedMapMask Code = 0xf
  36. Map16 Code = 0xde
  37. Map32 Code = 0xdf
  38. FixExt1 Code = 0xd4
  39. FixExt2 Code = 0xd5
  40. FixExt4 Code = 0xd6
  41. FixExt8 Code = 0xd7
  42. FixExt16 Code = 0xd8
  43. Ext8 Code = 0xc7
  44. Ext16 Code = 0xc8
  45. Ext32 Code = 0xc9
  46. )
  47. func IsFixedNum(c Code) bool {
  48. return c <= PosFixedNumHigh || c >= NegFixedNumLow
  49. }
  50. func IsFixedMap(c Code) bool {
  51. return c >= FixedMapLow && c <= FixedMapHigh
  52. }
  53. func IsFixedArray(c Code) bool {
  54. return c >= FixedArrayLow && c <= FixedArrayHigh
  55. }
  56. func IsFixedString(c Code) bool {
  57. return c >= FixedStrLow && c <= FixedStrHigh
  58. }
  59. func IsExt(c Code) bool {
  60. return (c >= FixExt1 && c <= FixExt16) || (c >= Ext8 && c <= Ext32)
  61. }