// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
// SPDX-License-Identifier: MIT

// Package util implements utilities to better support Fec decoding / encoding.
package util // BitArray provides support for bitmask manipulations. type BitArray struct { Lo uint64 // leftmost 64 bits Hi uint64 // rightmost 64 bits } // SetBit sets a bit to the specified bit value on the bitmask. func ( *BitArray) ( uint32) { if < 64 { .Lo |= uint64(0b1) << (63 - ) } else { := - 64 .Hi |= uint64(0b1) << (63 - ) } } // Reset clears the bitmask. func ( *BitArray) () { .Lo = 0 .Hi = 0 } // GetBit returns the bit value at a specified index of the bitmask. func ( *BitArray) ( uint32) uint8 { if < 64 { := (.Lo & (uint64(0b1) << (63 - ))) if > 0 { return 1 } return 0 } := - 64 := (.Hi & (uint64(0b1) << (63 - ))) if > 0 { return 1 } return 0 }