Oakrey.BitArray
3.0.0
dotnet add package Oakrey.BitArray --version 3.0.0
NuGet\Install-Package Oakrey.BitArray -Version 3.0.0
<PackageReference Include="Oakrey.BitArray" Version="3.0.0" />
<PackageVersion Include="Oakrey.BitArray" Version="3.0.0" />
<PackageReference Include="Oakrey.BitArray" />
paket add Oakrey.BitArray --version 3.0.0
#r "nuget: Oakrey.BitArray, 3.0.0"
#:package Oakrey.BitArray@3.0.0
#addin nuget:?package=Oakrey.BitArray&version=3.0.0
#tool nuget:?package=Oakrey.BitArray&version=3.0.0
Oakrey.BitArray
Overview
The BitArray project is a specialized library designed to provide efficient and flexible manipulation of bits and bit arrays. It offers a robust set of tools for working with binary data, enabling developers to perform operations such as reading, writing, and transforming bits with high performance and precision. The project is particularly useful in scenarios where low-level bit manipulation is required, such as data compression, encoding, or hardware communication.
Features of the BitArray Project
Fast and Efficient Bit Array Implementation
Class: FastBitArray
Description:
- A high-performance, immutable structure for managing bits.
- Provides direct access to individual bits and slices of bits.
Key Highlights:
- Supports bit-level operations like Get, Set, and Clear.
- Allows slicing of bit arrays for partial manipulation.
- Implements IEnumerable<bool> for easy iteration over bits.
Numeric Bit Array
Class: NumericBitArray
Description:
- A wrapper around FastBitArray that adds support for numeric operations.
- Enables reading and writing of numeric values (e.g., integers, floating-point -numbers) directly from/to bit arrays.
Key Highlights:
- Supports various numeric types: byte, short, int, long, float, double, etc.
- Provides methods for converting between numeric values and their binary - representations.
- Includes scaling and offset capabilities for numeric transformations.
Bit Array Extensions
- Class: NumericBitArrayExtensions
Description:
- Extends the functionality of NumericBitArray with additional operations.
Key Highlights:
- GetZigzagUshort and SetZigzagUshort: Read and write 16-bit values in a zigzag pattern for specialized encoding.
- Utility methods for reversing bits and validating lengths.
Custom Exception Handling
Class: BitArrayOutOfRangeException
Description:
- A custom exception class for handling out-of-range errors in bit array operations.
Key Highlights:
- Provides detailed error messages for invalid indices, lengths, or slices.
- Includes static helper methods for validating parameters.
Bit Array Enumerator
Class: FastBitArrayEnumerator
Description:
- An enumerator for iterating over the bits in a FastBitArray.
Key Highlights:
- Implements IEnumerator<bool> for seamless integration with LINQ and other .NET collection utilities.
- Supports resetting and disposing of the enumerator.
Example Use Cases
- Binary Data Manipulation: Use FastBitArray to efficiently manage and manipulate binary data at the bit level.
- Numeric Encoding and Decoding: Use NumericBitArray to encode numeric values into binary form and decode them back with scaling and offset.
- Custom Bit Patterns: Use NumericBitArrayExtensions to implement specialized encoding schemes, such as zigzag patterns.
- Error Handling: Leverage BitArrayOutOfRangeException to ensure robust error handling in bit manipulation operations.
- Iteration: Use FastBitArrayEnumerator to iterate over bits in a FastBitArray for analysis or transformation.
Installation
You can install the package via NuGet Package Manager, Package Manager Console or the .NET CLI.
NuGet Package Manager
- Open your project in Visual Studio.
- Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution....
- Search for
Oakrey.BitArraysand click Install.
.NET CLI
Run the following command in your terminal:
dotnet add package Oakrey.BitArrays
Package Manager Console
Run the following command in your Package Manager Console:
Install-Package Oakrey.BitArrays
Requirements
- .NET 8 or higher
Project Information
- Author: Oakrey
- Company: Oakrey
- License: MIT
- Repository: Git Repository
- Project URL: Project Website
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests to improve the package.
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Oakrey.BitArray:
| Package | Downloads |
|---|---|
|
Oakrey.Network.Abstractions
Foundational .NET abstractions for network packet parsing and address management. Includes base classes and interfaces for Ethernet, IPv4, and IPv6 packet headers (MacPacketHead, IPv4PacketHead, IPv6PacketHead), transport and network layer abstractions, protocol enums (EtherType, IpProtocol), IP address range types, and raw packet utilities. Integrates with PacketDotNet. |
|
|
Oakrey.DBC
Oakrey.DBC is a .NET 10 library for parsing, building, and exporting DBC (CAN database) files. Provides a full object model covering messages, signals (including multiplexing, big/little endian, scale/offset), nodes, attributes, value tables, and relationships. Supports async file parsing via DbcMatrix.CreateAsync and round-trip export via SaveDBC. Designed for automotive, industrial, and IoT applications. |
|
|
Oakrey.DBC.Values
Oakrey.DBC.Values is a .NET 10 library that adds live signal value handling on top of Oakrey.DBC. SignalValue wraps a DBC Signal template with NumericBitArray-backed raw and scaled double access, implements INotifyPropertyChanged for data-binding support, and tracks decimal precision from the signal scale. TaskMessage composes a full CAN message payload from its signal set, supports mux-ID dispatch in SetValues, and maintains a rolling receive history via FixedSizedQueue. Designed for automotive, industrial, and IoT CAN data processing. |
|
|
Oakrey.LDF.Values
Runtime value layer for LIN frames and signals built on top of Oakrey.LDF. Provides LdfSignalValue with INotifyPropertyChanged and physical value decoding via encoding offset and scale, and LdfTaskFrame for composing and parsing raw LIN message bytes across all positioned signals. |
GitHub repositories
This package is not used by any popular GitHub repositories.