Source File
bitarray.go
Belonging Package
github.com/pion/interceptor/pkg/flexfec/util
// 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 bitsHi 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}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |