From ae49f42c0ce1959f0540de96aa1ac11d00ecd8f0 Mon Sep 17 00:00:00 2001 From: brent saner Date: Sun, 14 Apr 2024 01:54:59 -0400 Subject: [PATCH] v1.6.0 Added bitmask/MaskBit.Copy() --- bitmask/bitmask.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bitmask/bitmask.go b/bitmask/bitmask.go index 4080e3b..5d3ac7f 100644 --- a/bitmask/bitmask.go +++ b/bitmask/bitmask.go @@ -2,8 +2,8 @@ package bitmask import ( "bytes" - "errors" "encoding/binary" + "errors" "math/bits" ) @@ -109,6 +109,15 @@ func (m *MaskBit) Bytes(trim bool) (b []byte) { return } +// Copy returns a pointer to a (new) copy of a MaskBit. +func (m *MaskBit) Copy() (newM *MaskBit) { + + newM = new(MaskBit) + *newM = *m + + return +} + // Value returns the current raw uint value of a MaskBit. func (m *MaskBit) Value() (v uint) {