mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Introduce AddressMask.AsSlice
...to get a slice view into the AddressMask. PiperOrigin-RevId: 532583738
This commit is contained in:
committed by
gVisor bot
parent
74e63e9e29
commit
891259ffa8
@@ -326,6 +326,12 @@ func (m AddressMask) String() string {
|
||||
return fmt.Sprintf("%x", m.mask)
|
||||
}
|
||||
|
||||
// AsSlice returns a as a byte slice. Callers should be careful as it can
|
||||
// return a window into existing memory.
|
||||
func (m *AddressMask) AsSlice() []byte {
|
||||
return []byte(m.mask)
|
||||
}
|
||||
|
||||
// BitLen returns the length of the mask in bits.
|
||||
func (m AddressMask) BitLen() int {
|
||||
return len(m.mask) * 8
|
||||
|
||||
Reference in New Issue
Block a user