bitmap

package module
v0.0.0-...-9b1b795 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 0 Imported by: 0

README

位图


ctrl c/v永不过时 !!!

├─bitmap_map.go          map实现位图(可无限制扩容, 适合较大但是稀疏的位图)
├─bitmap_slice.go        切片实现位图(需要提前指定大小,适合数据集中的位图)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitMapSwitchByMap

type BitMapSwitchByMap struct {
	// contains filtered or unexported fields
}

func NewBitMapSwitchMap

func NewBitMapSwitchMap() *BitMapSwitchByMap

NewBitMapSwitchMap 初始化位图开关

func (*BitMapSwitchByMap) IsOn

func (b *BitMapSwitchByMap) IsOn(switchIndex int) bool

IsOn 检查指定位置的开关状态

func (*BitMapSwitchByMap) TurnOff

func (b *BitMapSwitchByMap) TurnOff(switchIndex int)

TurnOff 关闭指定位置的开关

func (*BitMapSwitchByMap) TurnOn

func (b *BitMapSwitchByMap) TurnOn(switchIndex int)

TurnOn 打开指定位置的开关

type BitMapSwitchForSlice

type BitMapSwitchForSlice struct {
	// contains filtered or unexported fields
}

func NewBitMapSwitch

func NewBitMapSwitch(numSwitches int) *BitMapSwitchForSlice

NewBitMapSwitch 初始化位图开关 numSwitches: 初始化需要指定位图大小,避免无限制扩容

func (*BitMapSwitchForSlice) IsOn

func (b *BitMapSwitchForSlice) IsOn(switchIndex int) bool

IsOn 检查指定位置的开关状态

func (*BitMapSwitchForSlice) TurnOff

func (b *BitMapSwitchForSlice) TurnOff(switchIndex int)

TurnOff 关闭指定位置的开关

func (*BitMapSwitchForSlice) TurnOn

func (b *BitMapSwitchForSlice) TurnOn(switchIndex int)

TurnOn 打开指定位置的开关

Jump to

Keyboard shortcuts

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