From 296e9fc0f8812ce0c5684ff99f84e80eef07cd4c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 13 Jul 2022 21:44:18 -0600 Subject: Move files to different packages [ci-skip] --- lib/util/bitfield.go | 54 ---------------------------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 lib/util/bitfield.go (limited to 'lib/util/bitfield.go') diff --git a/lib/util/bitfield.go b/lib/util/bitfield.go deleted file mode 100644 index b3dbe0a..0000000 --- a/lib/util/bitfield.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2022 Luke Shumaker -// -// SPDX-License-Identifier: GPL-2.0-or-later - -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<