| 216 | } |
| 217 | |
| 218 | func (e *Encoder) encodeGenerationV2Data(generationV2Data []uint64) (overflows []uint64, err error) { |
| 219 | head := 0 |
| 220 | for _, data := range generationV2Data { |
| 221 | if data >= 0x80000000 { |
| 222 | // overflow |
| 223 | if err = binary.WriteUint32(e, uint32(head)|0x80000000); err != nil { |
| 224 | return nil, err |
| 225 | } |
| 226 | generationV2Data[head] = data |
| 227 | head++ |
| 228 | continue |
| 229 | } |
| 230 | if err = binary.WriteUint32(e, uint32(data)); err != nil { |
| 231 | return nil, err |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | return generationV2Data[:head], nil |
| 236 | } |
| 237 | |
| 238 | func (e *Encoder) encodeGenerationV2Overflow(overflows []uint64) (err error) { |
| 239 | for _, overflow := range overflows { |