本文整理匯總了Golang中C.Word_t函數的典型用法代碼示例。如果您正苦於以下問題:Golang Word_t函數的具體用法?Golang Word_t怎麽用?Golang Word_t使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Word_t函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Test
func (j *Judy1) Test(index uint64) (exists bool) {
st := C.Judy1Test(C.Pcvoid_t(j.val), C.Word_t(index), nil)
if st != 0 {
exists = true
}
return
}
示例2: Get
// Get the Value associated with Index in the Judy array
// returns (value, true) if the index was found
// returns (_, false) if the index was not found
func (j *JudyL) Get(index uint64) (uint64, bool) {
pval := unsafe.Pointer(C.JudyLGet(C.Pcvoid_t(j.array), C.Word_t(index), nil))
if pval == nil {
return 0, false
} else {
return uint64(*((*C.Word_t)(pval))), true
}
}
示例3: First
// Search (inclusive) for the first index present that is equal to or greater than the passed index.
// (Start with index = 0 to find the first index in the array.) This is typically used to begin a sorted-order scan of the indexes present in a Judy1 array.
//
// index - search index
// returns uint64 - value of the first index that is equal to or 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) First(index uint64) (uint64, bool) {
var idx C.Word_t = C.Word_t(index)
if C.Judy1First(C.Pcvoid_t(j.array), &idx, nil) != 0 {
return uint64(idx), true
} else {
return 0, false
}
}
示例4: Prev
func (j *Judy1) Prev(index uint64) (prevIndex uint64, found bool) {
index0 := C.Word_t(index)
st := C.Judy1Prev(C.Pcvoid_t(j.val), &index0, nil)
if st != 0 {
prevIndex = uint64(index0)
found = true
}
return
}
示例5: ByCount
// Locate the Nth index that is present in the Judy1 array (Nth = 1 returns the first index present).
//
// nth - nth index to find
// returns uint64 - nth index (unless return false))
// bool - true if the search was successful, false if an index was not found
func (j *Judy1) ByCount(nth uint64) (uint64, bool) {
var idx C.Word_t
if C.Judy1ByCount(C.Pcvoid_t(j.array), C.Word_t(nth), &idx, nil) != 0 {
return uint64(idx), true
} else {
return 0, false
}
}
示例6: First
func (j *Judy1) First(index uint64) (firstIndex uint64, found bool) {
index0 := C.Word_t(index)
st := C.Judy1First(C.Pcvoid_t(j.val), &index0, nil)
if st != 0 {
firstIndex = uint64(index0)
found = true
}
return
}
示例7: NextEmpty
func (j *Judy1) NextEmpty(index uint64) (nextIndex uint64, found bool) {
index0 := C.Word_t(index)
st := C.Judy1NextEmpty(C.Pcvoid_t(j.val), &index0, nil)
if st != 0 {
nextIndex = uint64(index0)
found = true
}
return
}
示例8: ByCount
func (j *Judy1) ByCount(count uint64) (index uint64, found bool) {
var ret C.Word_t = 0
st := C.Judy1ByCount(C.Pcvoid_t(j.val), C.Word_t(count), &ret, nil)
if st == 1 {
found = true
index = uint64(ret)
}
return
}
示例9: First
// Search (inclusive) for the first index present that is equal to or greater than the passed index.
// (Start with index = 0 to find the first index in the array.) This is typically used to begin a sorted-order scan of the indexes present in a JudyL array.
//
// index - search index
// returns uint64 - value of the first index that is equal to or greater than the passed index
// (only if bool return value is true)
// uint64 - value pointed to by the index
// bool - true if the search was successful, false if an index was not found
func (j *JudyL) First(index uint64) (uint64, uint64, bool) {
idx := C.Word_t(index)
pval := unsafe.Pointer(C.JudyLFirst(C.Pcvoid_t(j.array), &idx, nil))
if pval == nil {
return 0, 0, false
} else {
return uint64(idx), uint64(*((*C.Word_t)(pval))), true
}
}
示例10: ByCount
// Locate the Nth index that is present in the JudyL array (Nth = 1 returns the first index present).
//
// nth - nth index to find
// returns uint64 - nth index (unless return false)
// uint64 - nth value (unless return false)
// bool - true if the search was successful, false if an index was not found
func (j *JudyL) ByCount(nth uint64) (uint64, uint64, bool) {
var idx C.Word_t
pval := unsafe.Pointer(C.JudyLByCount(C.Pcvoid_t(j.array), C.Word_t(nth), &idx, nil))
if pval == nil {
return 0, 0, false
} else {
return uint64(idx), uint64(*((*C.Word_t)(pval))), true
}
}
示例11: CountFrom
// Count the number of indexes present in the JudyL array between indexA and indexB (inclusive).
// Returns the count. A return value of 0 can be valid as a count, or it can indicate a special case for fully populated array (32-bit machines only). See libjudy docs for ways to resolve this.
func (j *JudyL) CountFrom(indexA, indexB uint64) uint64 {
return uint64(C.JudyLCount(C.Pcvoid_t(j.array), C.Word_t(indexA), C.Word_t(indexB), nil))
}
示例12: Test
// Test if index's bit is set in the Judy1 array.
// Return true if index's bit is set (index is present), false if it is unset (index is absent).
func (j *Judy1) Test(index uint64) bool {
return C.Judy1Test(C.Pcvoid_t(j.array), C.Word_t(index), nil) != 0
}
示例13: Count
func (j *Judy1) Count(index1 uint64, index2 uint64) uint64 {
return uint64(C.Judy1Count(C.Pcvoid_t(j.val), C.Word_t(index1), C.Word_t(index2), nil))
}
示例14: Unset
func (j *Judy1) Unset(bit uint64) {
C.Judy1Unset(C.PPvoid_t(&j.val), C.Word_t(bit), nil)
}
示例15: Unset
// 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
}