Tedd.BitUtils NuGet Package

Fast bit manipulation extension methods for SByte, Byte, Int16, UInt16, Int32, UInt32, Int64 and UInt64: SetBit, SetBit0, SetBit1, ToggleBit, IsBitSet, Rol, Ror, ReverseBits, ReverseEndianness, PopCount, Parity, LeadingZeroCount, TrailingZeroCount, Log2, BitLength, IsPowerOfTwo, RoundUpToPowerOf2, ExtractLowestSetBit, ResetLowestSetBit, GetMaskUpToLowestSetBit, ExtractHighestSetBit, ZeroHighBits, ZeroLowBits, ParallelBitExtract (PEXT), ParallelBitDeposit (PDEP), Pack, Unpack, ZigZagEncode, ZigZagDecode, ToBitString.

Backed by System.Numerics.BitOperations and hardware intrinsics (POPCNT, LZCNT, TZCNT, BMI1, BMI2, BSWAP, ARM RBIT) with automatic runtime fallback. Also includes an allocation-free bit packing layer over Span<byte>: BitPacking/BitWriter/BitReader for arbitrary width bit fields at any bit offset, and the variable length integer encodings built on them - VarInt (ULEB128, SLEB128, ZigZag), EbmlVInt (RFC 8794) and SizePrefix.




Got any Tedd.BitUtils Question?





Info

Version: 2.2.0
Author(s): Tedd Hansen
Last Update: Sunday, September 20, 2026
.NET Fiddle: Create the first Fiddle
Project Url: https://github.com/tedd/Tedd.BitUtils
NuGet Url: https://www.nuget.org/packages/Tedd.BitUtils


Install
Install-Package Tedd.BitUtils
dotnet add package Tedd.BitUtils
paket add Tedd.BitUtils
Tedd.BitUtils Download (Unzip the "nupkg" after downloading)

net461
  • No dependencies.
net462
  • No dependencies.
net48
  • No dependencies.
netcoreapp2.0
  • No dependencies.
netcoreapp2.1
  • No dependencies.
netcoreapp3.0
  • No dependencies.
netcoreapp3.1
  • No dependencies.
netstandard2.1
  • No dependencies.


Tags



STATS

must-have-score

avg-downloads-per-day

3

days-since-last-release

18