frame_gen.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // Code generated by `gen.exe`. DO NOT EDIT.
  2. package lz4stream
  3. import "github.com/pierrec/lz4/v4/internal/lz4block"
  4. // DescriptorFlags is defined as follow:
  5. // field bits
  6. // ----- ----
  7. // _ 2
  8. // ContentChecksum 1
  9. // Size 1
  10. // BlockChecksum 1
  11. // BlockIndependence 1
  12. // Version 2
  13. // _ 4
  14. // BlockSizeIndex 3
  15. // _ 1
  16. type DescriptorFlags uint16
  17. // Getters.
  18. func (x DescriptorFlags) ContentChecksum() bool { return x>>2&1 != 0 }
  19. func (x DescriptorFlags) Size() bool { return x>>3&1 != 0 }
  20. func (x DescriptorFlags) BlockChecksum() bool { return x>>4&1 != 0 }
  21. func (x DescriptorFlags) BlockIndependence() bool { return x>>5&1 != 0 }
  22. func (x DescriptorFlags) Version() uint16 { return uint16(x >> 6 & 0x3) }
  23. func (x DescriptorFlags) BlockSizeIndex() lz4block.BlockSizeIndex {
  24. return lz4block.BlockSizeIndex(x >> 12 & 0x7)
  25. }
  26. // Setters.
  27. func (x *DescriptorFlags) ContentChecksumSet(v bool) *DescriptorFlags {
  28. const b = 1 << 2
  29. if v {
  30. *x = *x&^b | b
  31. } else {
  32. *x &^= b
  33. }
  34. return x
  35. }
  36. func (x *DescriptorFlags) SizeSet(v bool) *DescriptorFlags {
  37. const b = 1 << 3
  38. if v {
  39. *x = *x&^b | b
  40. } else {
  41. *x &^= b
  42. }
  43. return x
  44. }
  45. func (x *DescriptorFlags) BlockChecksumSet(v bool) *DescriptorFlags {
  46. const b = 1 << 4
  47. if v {
  48. *x = *x&^b | b
  49. } else {
  50. *x &^= b
  51. }
  52. return x
  53. }
  54. func (x *DescriptorFlags) BlockIndependenceSet(v bool) *DescriptorFlags {
  55. const b = 1 << 5
  56. if v {
  57. *x = *x&^b | b
  58. } else {
  59. *x &^= b
  60. }
  61. return x
  62. }
  63. func (x *DescriptorFlags) VersionSet(v uint16) *DescriptorFlags {
  64. *x = *x&^(0x3<<6) | (DescriptorFlags(v) & 0x3 << 6)
  65. return x
  66. }
  67. func (x *DescriptorFlags) BlockSizeIndexSet(v lz4block.BlockSizeIndex) *DescriptorFlags {
  68. *x = *x&^(0x7<<12) | (DescriptorFlags(v) & 0x7 << 12)
  69. return x
  70. }
  71. // Code generated by `gen.exe`. DO NOT EDIT.
  72. // DataBlockSize is defined as follow:
  73. // field bits
  74. // ----- ----
  75. // size 31
  76. // Uncompressed 1
  77. type DataBlockSize uint32
  78. // Getters.
  79. func (x DataBlockSize) size() int { return int(x & 0x7FFFFFFF) }
  80. func (x DataBlockSize) Uncompressed() bool { return x>>31&1 != 0 }
  81. // Setters.
  82. func (x *DataBlockSize) sizeSet(v int) *DataBlockSize {
  83. *x = *x&^0x7FFFFFFF | DataBlockSize(v)&0x7FFFFFFF
  84. return x
  85. }
  86. func (x *DataBlockSize) UncompressedSet(v bool) *DataBlockSize {
  87. const b = 1 << 31
  88. if v {
  89. *x = *x&^b | b
  90. } else {
  91. *x &^= b
  92. }
  93. return x
  94. }