math

package
v0.0.0-...-1329066 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBits

func GetBits(b byte, mask byte) byte

GetBits extracts the value of bits for a given mask

Example: given b = 0b11011001 and mask = 0b11100000, the function returns 0b110

func IsBitSet

func IsBitSet(b byte, position uint8) bool

IsBitSet returns true if the bit at the given position (0-7) is set in the byte, false otherwise

func SetBit

func SetBit(b *byte, position uint8)

SetBit sets the bit at the given position (0-7) in the byte to 1

func SetBits

func SetBits(b byte, mask byte, value byte) byte

SetBits sets the value to the bits specified in the mask

Example: given b = 0b00100001 and mask = 0b11100000, and value = 0b110, the function returns 0b11000001

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL