// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MITpackage rtcp// getPadding Returns the padding required to make the length a multiple of 4func getPadding( int) int {if %4 == 0 {return0 }return4 - ( % 4)}// setNBitsOfUint16 will truncate the value to size, left-shift to startIndex position and setfunc setNBitsOfUint16(, , , uint16) (uint16, error) {if + > 16 {return0, errInvalidSizeOrStartIndex }// truncate val to size bits &= (1 << ) - 1return | ( << (16 - - )), nil}// appendBit32 will left-shift and append n bits of valfunc appendNBitsToUint32(, , uint32) uint32 {return ( << ) | ( & (0xFFFFFFFF >> (32 - )))}// getNBit get n bits from 1 byte, begin with a positionfunc getNBitsFromByte( byte, , uint16) uint16 { := 8 - ( + ) := (0xFF >> ) & uint8(0xFF<<)returnuint16(&) >> }// get24BitFromBytes get 24bits from `[3]byte` slicefunc get24BitsFromBytes( []byte) uint32 {returnuint32([0])<<16 + uint32([1])<<8 + uint32([2])}
The pages are generated with Goldsv0.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.