bitseq

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package bitseq applies bitwise operations to sequences of integers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And[T Integer](sequence iter.Seq[T]) T

And combines all items from sequence via bitwise AND. Returns -1 (all bits set to 1) if the sequence is empty. Stops iterating as soon as an intermediate value with all bits set to 0 is reached.

Runs forever if given an infinite sequence of values such that an intermediate value of 0 is never reached.

func Or

func Or[T Integer](sequence iter.Seq[T]) T

Or combines all items from sequence via bitwise OR. Returns 0 if the sequence is empty. Stops iterating as soon as an intermediate value with all bits set to 1 is reached.

Runs forever if given an infinite sequence of values such that an itermediate value with all bits set to 1 is never reached.

Types

type Integer

type Integer interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 | ~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Integer is a constraint for any of the integer types.

Jump to

Keyboard shortcuts

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