当前位置: 首页>>代码示例>>Golang>>正文


Golang C.Word_t函数代码示例

本文整理汇总了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
}
开发者ID:bickfordb,项目名称:judy,代码行数:7,代码来源:judy1.go

示例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
	}
}
开发者ID:riobard,项目名称:go-judy,代码行数:11,代码来源:judyl.go

示例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
	}
}
开发者ID:riobard,项目名称:go-judy,代码行数:15,代码来源:judy1.go

示例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
}
开发者ID:bickfordb,项目名称:judy,代码行数:9,代码来源:judy1.go

示例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
	}
}
开发者ID:riobard,项目名称:go-judy,代码行数:14,代码来源:judy1.go

示例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
}
开发者ID:bickfordb,项目名称:judy,代码行数:9,代码来源:judy1.go

示例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
}
开发者ID:bickfordb,项目名称:judy,代码行数:9,代码来源:judy1.go

示例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
}
开发者ID:bickfordb,项目名称:judy,代码行数:9,代码来源:judy1.go

示例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
	}
}
开发者ID:riobard,项目名称:go-judy,代码行数:18,代码来源:judyl.go

示例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
	}
}
开发者ID:riobard,项目名称:go-judy,代码行数:16,代码来源:judyl.go

示例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))
}
开发者ID:riobard,项目名称:go-judy,代码行数:5,代码来源:judyl.go

示例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
}
开发者ID:riobard,项目名称:go-judy,代码行数:5,代码来源:judy1.go

示例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))
}
开发者ID:bickfordb,项目名称:judy,代码行数:3,代码来源:judy1.go

示例14: Unset

func (j *Judy1) Unset(bit uint64) {
	C.Judy1Unset(C.PPvoid_t(&j.val), C.Word_t(bit), nil)
}
开发者ID:bickfordb,项目名称:judy,代码行数:3,代码来源:judy1.go

示例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
}
开发者ID:riobard,项目名称:go-judy,代码行数:5,代码来源:judy1.go


注:本文中的C.Word_t函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。