github.com/balzaczyy/golucene@v0.0.0-20151210033525-d0be9ee89713/core/util/packed/bulkOperation4.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 BulkOperationPacked4 struct {
     7  	*BulkOperationPacked
     8  }
     9  
    10  func newBulkOperationPacked4() BulkOperation {
    11  	return &BulkOperationPacked4{newBulkOperationPacked(4)}
    12  }
    13  
    14  func (op *BulkOperationPacked4) 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(60); shift >= 0; shift -= 4 {
    19  			values[valuesOffset] = int32((int64(uint64(block) >> shift)) & 15); valuesOffset++
    20  		}
    21  	}
    22  }
    23  
    24  func (op *BulkOperationPacked4) decodeByteToInt(blocks []byte, values []int32, iterations int) {
    25  	blocksOffset, valuesOffset := 0, 0
    26  	for j := 0; j < iterations; j ++ {
    27  		block := blocks[blocksOffset]
    28  		blocksOffset++
    29  		values[valuesOffset] = int32(byte(uint8(block)) >> 4) & 15
    30  		valuesOffset++
    31  		values[valuesOffset] = int32(block & 15)
    32  		valuesOffset++
    33  	}
    34  }
    35  func (op *BulkOperationPacked4) decodeLongToLong(blocks []int64, values []int64, iterations int) {
    36  	blocksOffset, valuesOffset := 0, 0
    37  	for i := 0; i < iterations; i ++ {
    38  		block := blocks[blocksOffset]; blocksOffset++
    39  		for shift := uint(60); shift >= 0; shift -= 4 {
    40  			values[valuesOffset] = (int64(uint64(block) >> shift)) & 15; valuesOffset++
    41  		}
    42  	}
    43  }
    44  
    45  func (op *BulkOperationPacked4) decodeByteToLong(blocks []byte, values []int64, iterations int) {
    46  	blocksOffset, valuesOffset := 0, 0
    47  	for j := 0; j < iterations; j ++ {
    48  		block := blocks[blocksOffset]
    49  		blocksOffset++
    50  		values[valuesOffset] = int64(byte(uint8(block)) >> 4) & 15
    51  		valuesOffset++
    52  		values[valuesOffset] = int64(block & 15)
    53  		valuesOffset++
    54  	}
    55  }