github.com/vc42/parquet-go@v0.0.0-20240320194221-1a9adb5f23f5/bloom/xxhash/sum64uint_purego.go (about)

     1  //go:build purego || !amd64
     2  
     3  package xxhash
     4  
     5  func MultiSum64Uint8(h []uint64, v []uint8) int {
     6  	n := min(len(h), len(v))
     7  	h = h[:n]
     8  	v = v[:n]
     9  	for i := range v {
    10  		h[i] = Sum64Uint8(v[i])
    11  	}
    12  	return n
    13  }
    14  
    15  func MultiSum64Uint16(h []uint64, v []uint16) int {
    16  	n := min(len(h), len(v))
    17  	h = h[:n]
    18  	v = v[:n]
    19  	for i := range v {
    20  		h[i] = Sum64Uint16(v[i])
    21  	}
    22  	return n
    23  }
    24  
    25  func MultiSum64Uint32(h []uint64, v []uint32) int {
    26  	n := min(len(h), len(v))
    27  	h = h[:n]
    28  	v = v[:n]
    29  	for i := range v {
    30  		h[i] = Sum64Uint32(v[i])
    31  	}
    32  	return n
    33  }
    34  
    35  func MultiSum64Uint64(h []uint64, v []uint64) int {
    36  	n := min(len(h), len(v))
    37  	h = h[:n]
    38  	v = v[:n]
    39  	for i := range v {
    40  		h[i] = Sum64Uint64(v[i])
    41  	}
    42  	return n
    43  }
    44  
    45  func MultiSum64Uint128(h []uint64, v [][16]byte) int {
    46  	n := min(len(h), len(v))
    47  	h = h[:n]
    48  	v = v[:n]
    49  	for i := range v {
    50  		h[i] = Sum64Uint128(v[i])
    51  	}
    52  	return n
    53  }
    54  
    55  func min(a, b int) int {
    56  	if a < b {
    57  		return a
    58  	}
    59  	return b
    60  }