本文整理汇总了Golang中github.com/jainvipin/bitset.BitSet类的典型用法代码示例。如果您正苦于以下问题:Golang BitSet类的具体用法?Golang BitSet怎么用?Golang BitSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BitSet类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ClearBitsOutsideRange
// ClearBitsOutsideRange sets all IPs outside range as used
func ClearBitsOutsideRange(ipAllocMap *bitset.BitSet, ipRange string, subnetLen uint) {
var i uint32
rangeMin, _ := ipv4ToUint32(getFirstAddrInRange(ipRange))
rangeMax, _ := ipv4ToUint32(getLastAddrInRange(ipRange, subnetLen))
firstAddr, _ := ipv4ToUint32(GetSubnetAddr(ipRange, subnetLen))
lastAddr, _ := ipv4ToUint32(getLastAddrInSubnet(ipRange, subnetLen))
// Set bits lower than rangeMin as used
for i = 0; i < (rangeMin - firstAddr); i++ {
ipAllocMap.Clear(uint(i))
}
// Set bits greater than the rangeMax as used
for i = ((rangeMin - firstAddr) + ((rangeMax - rangeMin) + 1)); i < (lastAddr - firstAddr); i++ {
ipAllocMap.Clear(uint(i))
}
}
开发者ID:jojimt,项目名称:netplugin,代码行数:18,代码来源:netutils.go
示例2: clearReservedVLANs
func clearReservedVLANs(vlanBitset *bitset.BitSet) {
vlanBitset.Clear(0)
vlanBitset.Clear(4095)
}
开发者ID:vvb,项目名称:netplugin,代码行数:4,代码来源:gstate.go
示例3: ClearReservedEntries
// ClearReservedEntries clears reserved bits
func ClearReservedEntries(b *bitset.BitSet, subnetLen uint) {
maxSize := (1 << (32 - subnetLen)) - 1
b.Clear(uint(maxSize))
b.Clear(uint(0))
}
开发者ID:jojimt,项目名称:netplugin,代码行数:6,代码来源:netutils.go
示例4: InitSubnetBitset
// InitSubnetBitset initializes a bit set with 2^(32 - subnetLen) bits
func InitSubnetBitset(b *bitset.BitSet, subnetLen uint) {
maxSize := (1 << (32 - subnetLen)) - 1
b.Set(uint(maxSize))
b.Set(uint(0))
}
开发者ID:jojimt,项目名称:netplugin,代码行数:6,代码来源:netutils.go
注:本文中的github.com/jainvipin/bitset.BitSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论