github.com/balzaczyy/golucene@v0.0.0-20151210033525-d0be9ee89713/core/util/packed/bulkOperation16.go (about) 1 // This file has been automatically generated, DO NOT EDIT 2 3 package packed 4 5 // Efficient sequential read/write of packed integers. 6 type BulkOperationPacked16 struct { 7 *BulkOperationPacked 8 } 9 10 func newBulkOperationPacked16() BulkOperation { 11 return &BulkOperationPacked16{newBulkOperationPacked(16)} 12 } 13 14 func (op *BulkOperationPacked16) decodeLongToInt(blocks []int64, values []int32, iterations int) { 15 blocksOffset, valuesOffset := 0, 0 16 for i := 0; i < iterations; i ++ { 17 block := blocks[blocksOffset]; blocksOffset++ 18 for shift := uint(48); shift >= 0; shift -= 16 { 19 values[valuesOffset] = int32((int64(uint64(block) >> shift)) & 65535); valuesOffset++ 20 } 21 } 22 } 23 24 func (op *BulkOperationPacked16) decodeByteToInt(blocks []byte, values []int32, iterations int) { 25 blocksOffset, valuesOffset := 0, 0 26 for j := 0; j < iterations; j ++ { 27 values[valuesOffset] = (int32(blocks[blocksOffset+0]) << 8) | int32(blocks[blocksOffset+1]) 28 valuesOffset++ 29 blocksOffset += 2 30 } 31 } 32 func (op *BulkOperationPacked16) decodeLongToLong(blocks []int64, values []int64, iterations int) { 33 blocksOffset, valuesOffset := 0, 0 34 for i := 0; i < iterations; i ++ { 35 block := blocks[blocksOffset]; blocksOffset++ 36 for shift := uint(48); shift >= 0; shift -= 16 { 37 values[valuesOffset] = (int64(uint64(block) >> shift)) & 65535; valuesOffset++ 38 } 39 } 40 } 41 42 func (op *BulkOperationPacked16) decodeByteToLong(blocks []byte, values []int64, iterations int) { 43 blocksOffset, valuesOffset := 0, 0 44 for j := 0; j < iterations; j ++ { 45 values[valuesOffset] = (int64(blocks[blocksOffset+0]) << 8) | int64(blocks[blocksOffset+1]) 46 valuesOffset++ 47 blocksOffset += 2 48 } 49 }