示例#1
0
文件: judy1.go 项目: bickfordb/judy
func (j *Judy1) Unset(bit uint64) {
	C.Judy1Unset(C.PPvoid_t(&j.val), C.Word_t(bit), nil)
}
示例#2
0
文件: judyl.go 项目: riobard/go-judy
// Free the entire JudyL array.
// Return the number of bytes freed.
//
// NOTE: The Judy array allocates memory directly from the operating system and is NOT garbage collected by the
// Go runtime. It is very important that you call Free() on a Judy array after using it to prevent memory leaks.
func (j *JudyL) Free() uint64 {
	return uint64(C.JudyLFreeArray(C.PPvoid_t(&j.array), nil))
}
示例#3
0
文件: judyl.go 项目: riobard/go-judy
// Insert an Index and Value into the JudyL array. If the Index is successfully inserted, the Value is
// initialized as well. If the Index was already present, the current Value is replaced with the provided Value.
func (j *JudyL) Insert(index uint64, value uint64) {
	pval := unsafe.Pointer(C.JudyLIns(C.PPvoid_t(&j.array), C.Word_t(index), nil))
	*((*C.Word_t)(pval)) = C.Word_t(value)
}
示例#4
0
文件: judyl.go 项目: riobard/go-judy
// Delete the Index/Value pair from the JudyL array.
// Returns true if successful. Returns false if Index was not present.
func (j *JudyL) Delete(index uint64) bool {
	return C.JudyLDel(C.PPvoid_t(&j.array), C.Word_t(index), nil) != 0
}
示例#5
0
文件: judy1.go 项目: riobard/go-judy
// Unset index's bit in the Judy1 array.
// Return true if index's bit was previously set (successful), otherwise false if the bit was already unset (unsuccessful).
func (j *Judy1) Unset(index uint64) bool {
	return C.Judy1Unset(C.PPvoid_t(&j.array), C.Word_t(index), nil) != 0
}