func Hash(scanner FeatureScanner) uint64 {
	var signs [64]int64

	for scanner.Scan() {
		b := scanner.Bytes()
		h := siphash.Hash(0, 0, b)

		for i := 0; i < 64; i++ {
			negate := int(h) & 1
			// if negate is 1, we will negate '-1', below
			r := (-1 ^ -negate) + negate
			signs[i] += int64(r)
			h >>= 1
		}
	}

	var shash uint64

	// TODO: can probably be done with SSE?
	for i := 63; i >= 0; i-- {
		shash <<= 1
		shash |= uint64(signs[i]>>63) & 1
	}

	return shash
}
// Hash returns a simhash value for the document returned by the scanner
Hash returns a simhash value for the document returned by the scanner
// Hash returns a simhash value for the document returned by the scanner
func Hash(scanner FeatureScanner) uint64 {
	var signs [64]int64
	for scanner.Scan() {
		b := scanner.Bytes()
		h := siphash.Hash(0, 0, b)
		for i := 0; i < 64; i++ {
			negate := int(h) & 1
			r := (-1 ^ -negate) + negate
			signs[i] += int64(r)
			h >>= 1
		}
	}
	var shash uint64
	for i := 63; i >= 0; i-- {
		shash <<= 1
		shash |= uint64(signs[i]>>63) & 1
	}
	return shash
}
func Hash ( scanner FeatureScanner ) uint64 { var signs [ 64 ] int64 for scanner . Scan ( ) { b := scanner . Bytes ( ) h := siphash . Hash ( 0 , 0 , b ) for i := 0 ; i < 64 ; i ++ { negate := int ( h ) & 1 r := ( - 1 ^ - negate ) + negate signs [ i ] += int64 ( r ) h >>= 1 } } var shash uint64 for i := 63 ; i >= 0 ; i -- { shash <<= 1 shash |= uint64 ( signs [ i ] >> 63 ) & 1 } return shash }
Hash returns a simhash value for the document returned by the scanner
Hash returns a simhash value for the document returned by the scanner
// if negate is 1, we will negate '-1', below // TODO: can probably be done with SSE?