04-convert-slice-of-bools-to-uint8

command
v0.0.0-...-9882766 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Turn a slice of 8 boolean values into a byte (uint8). Checks the first value of the bool slice, if true set the least significant bit to 1, and shift all bits 1 to the left. If the value from the bool slice is false, we just keep the default value added by the bit shift which is 0, and do another bit shift. No need to set a 0 value to 0.

Jump to

Keyboard shortcuts

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