Oakrey.BitArray 1.0.0

dotnet add package Oakrey.BitArray --version 1.0.0
                    
NuGet\Install-Package Oakrey.BitArray -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oakrey.BitArray" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.BitArray" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.BitArray" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oakrey.BitArray --version 1.0.0
                    
#r "nuget: Oakrey.BitArray, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Oakrey.BitArray&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.BitArray&version=1.0.0
                    
Install as a Cake Tool

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

  1. Binary Data Manipulation: Use FastBitArray to efficiently manage and manipulate binary data at the bit level.
  2. Numeric Encoding and Decoding: Use NumericBitArray to encode numeric values into binary form and decode them back with scaling and offset.
  3. Custom Bit Patterns: Use NumericBitArrayExtensions to implement specialized encoding schemes, such as zigzag patterns.
  4. Error Handling: Leverage BitArrayOutOfRangeException to ensure robust error handling in bit manipulation operations.
  5. 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

  1. Open your project in Visual Studio.
  2. Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution....
  3. Search for Oakrey.BitArrays and 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

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 Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Oakrey.BitArray:

Package Downloads
Oakrey.Network.Abstractions

The "Abstraction" project provides a comprehensive set of abstractions for network packet handling, protocol support, and address management. It simplifies the development of network tools by offering reusable components for transport and network layer operations.

Oakrey.DBC.Values

The DBC.Values library is a .NET 8 framework for managing and manipulating CAN signal values and messages. It provides tools for handling signal templates, multiplexed signals, and task messages. Designed for extensibility and performance, it is ideal for automotive, industrial, and IoT applications requiring CAN data processing.

Oakrey.DBC

The DBC library is a .NET 8 framework for parsing, managing, and exporting DBC files. It provides tools for handling CAN database elements such as messages, signals, nodes, and attributes. Designed for extensibility and performance, it is ideal for automotive, industrial, and IoT applications requiring DBC file management.

Oakrey.LDF.Values

Library for managing LIN signal and frame values, including signal encoding, frame content, and LIN message construction.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 256 2 months ago