Exemplo n.º 1
0
func (j *Judy1) Next(index uint64) (nextIndex uint64, found bool) {
	index0 := C.Word_t(index)
	st := C.Judy1Next(C.Pcvoid_t(j.val), &index0, nil)
	if st != 0 {
		nextIndex = uint64(index0)
		found = true
	}
	return
}
Exemplo n.º 2
0
// Search (exclusive) for the first index present that is greater than the passed index.
// This is typically used to continue a sorted-order scan of the indexes present in a Judy1 array.
//
//   index - search index
//   returns uint64 - value of the first index that is greater than the passed index (only if bool return value is true)
//           bool   - true if the search was successful, false if an index was not found
func (j *Judy1) Next(index uint64) (uint64, bool) {
	var idx C.Word_t = C.Word_t(index)

	if C.Judy1Next(C.Pcvoid_t(j.array), &idx, nil) != 0 {
		return uint64(idx), true
	} else {
		return 0, false
	}
}