github.com/balzaczyy/golucene@v0.0.0-20151210033525-d0be9ee89713/core/util/packed/bulkOperation1.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 BulkOperationPacked1 struct {
     7  	*BulkOperationPacked
     8  }
     9  
    10  func newBulkOperationPacked1() BulkOperation {
    11  	return &BulkOperationPacked1{newBulkOperationPacked(1)}
    12  }
    13  
    14  func (op *BulkOperationPacked1) 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(63); shift >= 0; shift -= 1 {
    19  			values[valuesOffset] = int32((int64(uint64(block) >> shift)) & 1); valuesOffset++
    20  		}
    21  	}
    22  }
    23  
    24  func (op *BulkOperationPacked1) 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)) >> 7) & 1
    30  		valuesOffset++
    31  		values[valuesOffset] = int32(byte(uint8(block)) >> 6) & 1
    32  		valuesOffset++
    33  		values[valuesOffset] = int32(byte(uint8(block)) >> 5) & 1
    34  		valuesOffset++
    35  		values[valuesOffset] = int32(byte(uint8(block)) >> 4) & 1
    36  		valuesOffset++
    37  		values[valuesOffset] = int32(byte(uint8(block)) >> 3) & 1
    38  		valuesOffset++
    39  		values[valuesOffset] = int32(byte(uint8(block)) >> 2) & 1
    40  		valuesOffset++
    41  		values[valuesOffset] = int32(byte(uint8(block)) >> 1) & 1
    42  		valuesOffset++
    43  		values[valuesOffset] = int32(block & 1)
    44  		valuesOffset++
    45  	}
    46  }
    47  func (op *BulkOperationPacked1) decodeLongToLong(blocks []int64, values []int64, iterations int) {
    48  	blocksOffset, valuesOffset := 0, 0
    49  	for i := 0; i < iterations; i ++ {
    50  		block := blocks[blocksOffset]; blocksOffset++
    51  		for shift := uint(63); shift >= 0; shift -= 1 {
    52  			values[valuesOffset] = (int64(uint64(block) >> shift)) & 1; valuesOffset++
    53  		}
    54  	}
    55  }
    56  
    57  func (op *BulkOperationPacked1) decodeByteToLong(blocks []byte, values []int64, iterations int) {
    58  	blocksOffset, valuesOffset := 0, 0
    59  	for j := 0; j < iterations; j ++ {
    60  		block := blocks[blocksOffset]
    61  		blocksOffset++
    62  		values[valuesOffset] = int64(byte(uint8(block)) >> 7) & 1
    63  		valuesOffset++
    64  		values[valuesOffset] = int64(byte(uint8(block)) >> 6) & 1
    65  		valuesOffset++
    66  		values[valuesOffset] = int64(byte(uint8(block)) >> 5) & 1
    67  		valuesOffset++
    68  		values[valuesOffset] = int64(byte(uint8(block)) >> 4) & 1
    69  		valuesOffset++
    70  		values[valuesOffset] = int64(byte(uint8(block)) >> 3) & 1
    71  		valuesOffset++
    72  		values[valuesOffset] = int64(byte(uint8(block)) >> 2) & 1
    73  		valuesOffset++
    74  		values[valuesOffset] = int64(byte(uint8(block)) >> 1) & 1
    75  		valuesOffset++
    76  		values[valuesOffset] = int64(block & 1)
    77  		valuesOffset++
    78  	}
    79  }