algorithms

package
v1.18.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BiSearch

func BiSearch[ValueType NumberType, T Element[ValueType]](sElement []T, value ValueType, matchUp int) int

BiSearch 二分查找,切片必需有序号。matchUp表示是否向上范围查找。比如:数列10 20 30 ,当value传入25时,返回结果是2,表示落到3的范围

func ClearBitwiseTag added in v1.18.6

func ClearBitwiseTag[Number BitNumber, UNumber UnsignedNumber](bitBuff []Number, bitPositionIndex UNumber) bool

func GetBitwiseNum added in v1.18.6

func GetBitwiseNum[Number BitNumber](bitBuff []Number) int

func GetBitwiseTag added in v1.18.6

func GetBitwiseTag[Number BitNumber, UNumber UnsignedNumber](bitBuff []Number, bitPositionIndex UNumber) (bool, error)

func SetBitwiseTag added in v1.18.6

func SetBitwiseTag[Number BitNumber, UNumber UnsignedNumber](bitBuff []Number, bitPositionIndex UNumber) bool

Types

type BitNumber added in v1.18.6

type BitNumber interface {
	int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | uintptr
}

type Element

type Element[ValueType NumberType] interface {
	GetValue() ValueType
}

type NumberType

type NumberType interface {
	int | int8 | int16 | int32 | int64 | string | float32 | float64 | uint | uint8 | uint16 | uint32 | uint64
}

type UnsignedNumber added in v1.18.6

type UnsignedNumber interface {
	uint | uint8 | uint16 | uint32 | uint64 | uintptr
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL