Example #1
0
func (qs *QuadStore) createKeyFor(d [4]quad.Direction, q quad.Quad) []byte {
	key := make([]byte, quad.HashSize*4)
	quad.HashTo(q.Get(d[0]), key[quad.HashSize*0:quad.HashSize*1])
	quad.HashTo(q.Get(d[1]), key[quad.HashSize*1:quad.HashSize*2])
	quad.HashTo(q.Get(d[2]), key[quad.HashSize*2:quad.HashSize*3])
	quad.HashTo(q.Get(d[3]), key[quad.HashSize*3:quad.HashSize*4])
	return key
}
Example #2
0
func createKeyFor(d [4]quad.Direction, q quad.Quad) []byte {
	key := make([]byte, 2+(quad.HashSize*4))
	key[0] = d[0].Prefix()
	key[1] = d[1].Prefix()
	quad.HashTo(q.Get(d[0]), key[2+quad.HashSize*0:2+quad.HashSize*1])
	quad.HashTo(q.Get(d[1]), key[2+quad.HashSize*1:2+quad.HashSize*2])
	quad.HashTo(q.Get(d[2]), key[2+quad.HashSize*2:2+quad.HashSize*3])
	quad.HashTo(q.Get(d[3]), key[2+quad.HashSize*3:2+quad.HashSize*4])
	return key
}
Example #3
0
func hashOf(s quad.Value) (out NodeHash) {
	if s == nil {
		return
	}
	quad.HashTo(s, out[:])
	return
}
Example #4
0
func createValueKeyFor(s quad.Value) []byte {
	key := make([]byte, 1+quad.HashSize)
	key[0] = 'z'
	quad.HashTo(s, key[1:])
	return key
}