From 27401b6ea459921a6152ab1744da1618358465f4 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 10 Jul 2022 13:18:30 -0600 Subject: Rename the module, mv pkg lib --- pkg/util/bitfield.go | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 pkg/util/bitfield.go (limited to 'pkg/util/bitfield.go') diff --git a/pkg/util/bitfield.go b/pkg/util/bitfield.go deleted file mode 100644 index 23da17a..0000000 --- a/pkg/util/bitfield.go +++ /dev/null @@ -1,50 +0,0 @@ -package util - -import ( - "fmt" - "strings" -) - -type BitfieldFormat uint8 - -const ( - HexNone = BitfieldFormat(iota) - HexLower - HexUpper -) - -func BitfieldString[T ~uint8 | ~uint16 | ~uint32 | ~uint64](bitfield T, bitnames []string, cfg BitfieldFormat) string { - var out strings.Builder - switch cfg { - case HexNone: - // do nothing - case HexLower: - fmt.Fprintf(&out, "0x%0x(", uint64(bitfield)) - case HexUpper: - fmt.Fprintf(&out, "0x%0X(", uint64(bitfield)) - } - if bitfield == 0 { - out.WriteString("none") - } else { - rest := bitfield - first := true - for i := 0; rest != 0; i++ { - if rest&(1<