// lookupValue determines the type of block n and looks up the value for b.
// For n < t.cutoff, the block is a simple lookup table. Otherwise, the block
// is a list of ranges with an accompanying value. Given a matching range r,
// the value for b is by r.value + (b - r.lo) * stride.
lookupValue determines the type of block n and looks up the value for b.
For n < t.cutoff, the block is a simple lookup table. Otherwise, the block
is a list of ranges with an accompanying value. Given a matching range r,
the value for b is by r.value + (b - r.lo) * stride.
// lookupValue determines the type of block n and looks up the value for b . // For n < t . cutoff the block is a simple lookup table . Otherwise the block // is a list of ranges with an accompanying value . Given a matching range r // the value for b is by r . value + ( b - r . lo ) * stride .
func (t *trie) lookupValue(n uint8, b byte) uint16 {
	if n < t.cutoff {
		return t.values[uint16(n)<<6+uint16(b&maskx)]
	}
	offset := t.sparseOffset[n-t.cutoff]
	header := t.sparse[offset]
	lo := offset + 1
	hi := lo + uint16(header.lo)
	for lo < hi {
		m := lo + (hi-lo)/2
		r := t.sparse[m]
		if r.lo <= b && b <= r.hi {
			return r.value + uint16(b-r.lo)*header.value
		}
		if b < r.lo {
			hi = m
		} else {
			lo = m + 1
		}
	}
	return 0
}
func ( t * trie ) lookupValue ( n uint8 , b byte ) uint16 { if n < t . cutoff { return t . values [ uint16 ( n ) << 6 + uint16 ( b & maskx ) ] } offset := t . sparseOffset [ n - t . cutoff ] header := t . sparse [ offset ] lo := offset + 1 hi := lo + uint16 ( header . lo ) for lo < hi { m := lo + ( hi - lo ) / 2 r := t . sparse [ m ] if r . lo <= b && b <= r . hi { return r . value + uint16 ( b - r . lo ) * header . value } if b < r . lo { hi = m } else { lo = m + 1 } } return 0 }
lookupValue determines the type of block n and looks up the value for b.
lookupValue determines the type of block n and looks up the value for b .