Documentation ¶
Index ¶
- Variables
- func CbmLen(cbm string) int
- func GenCPUResString(mapList []string, bitLen int) (string, error)
- func GenerateBitMap(coreids []string, num int) (string, error)
- func IsZeroHexString(s string) bool
- func SetField(obj interface{}, name string, value interface{}) error
- func StringInSlice(val string, list []string) bool
- type Bitmap
- func (b *Bitmap) And(m *Bitmap) *Bitmap
- func (b *Bitmap) Axor(m *Bitmap) *Bitmap
- func (b *Bitmap) GetConnectiveBits(ways, offset uint32, fromLow bool) *Bitmap
- func (b *Bitmap) IsEmpty() bool
- func (b *Bitmap) MaxConnectiveBits() *Bitmap
- func (b *Bitmap) Maximum() uint32
- func (b *Bitmap) Or(m *Bitmap) *Bitmap
- func (b *Bitmap) ToBinString() string
- func (b *Bitmap) ToBinStrings() []string
- func (b *Bitmap) ToHumanString() string
- func (b *Bitmap) ToString() string
- func (b *Bitmap) Xor(m *Bitmap) *Bitmap
Constants ¶
This section is empty.
Variables ¶
var AllDatas = regexp.MustCompile(`(\d+)`)
AllDatas what?
var BitMapBadExpression = regexp.MustCompile(`([^\^\d-,]+)|([^\d]+-.*(,|$))|` +
`([^,]*-[^\d]+)|(\^[^\d]+)|((\,\s)?\^$)`)
BitMapBadExpression is the wrong expression
var HexMap = map[byte]int{
'1': 1,
'3': 2,
'7': 3,
'f': 4,
'F': 4,
}
HexMap cbm are all consecutive bits
Functions ¶
func GenCPUResString ¶
GenCPUResString {"2-8,^3-4,^7,9", "56-87,^86"}
func GenerateBitMap ¶
GenerateBitMap generate bit map
func IsZeroHexString ¶
IsZeroHexString is zero hex string No verification for input s. Such as whitespace in "0x11, 22" and "g" in "0xg1111" Caller do verification.
func StringInSlice ¶
StringInSlice string in slice O(n), maybe key in map is O(1) Not sure a good way for golang to check a string in slice
Types ¶
type Bitmap ¶
Bitmap struct represents bit map
func NewBitmap ¶
NewBitmap create bit map from string, strings ... We can add a wraper for NewBitmap such as:
func NewCPUBitmap( value ...interface{}) (*Bitmap, error) { cpu_numbers := 88 return NewBitmap(cpu_numbers, value) }
func (*Bitmap) GetConnectiveBits ¶
GetConnectiveBits returns a connective bits for Bitmap by given ways, offset, and order
func (*Bitmap) MaxConnectiveBits ¶
MaxConnectiveBits returns MaxConnectiveBits
func (*Bitmap) ToBinStrings ¶
ToBinStrings to binary string slice
func (*Bitmap) ToHumanString ¶
ToHumanString returns human string of the bitmap, e.g. 1-2,10-11