{"id":22101128,"url":"https://github.com/rmja/bite","last_synced_at":"2025-03-24T02:20:04.548Z","repository":{"id":63166898,"uuid":"565717994","full_name":"rmja/Bite","owner":"rmja","description":"Fast bit access","archived":false,"fork":false,"pushed_at":"2022-11-15T14:19:00.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T01:26:33.382Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rmja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-14T07:14:04.000Z","updated_at":"2022-11-15T15:28:42.000Z","dependencies_parsed_at":"2023-01-21T19:00:40.566Z","dependency_job_id":null,"html_url":"https://github.com/rmja/Bite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmja%2FBite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmja%2FBite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmja%2FBite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rmja%2FBite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rmja","download_url":"https://codeload.github.com/rmja/Bite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245196013,"owners_count":20575949,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T05:23:40.086Z","updated_at":"2025-03-24T02:20:04.525Z","avatar_url":"https://github.com/rmja.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bite\n\n[![NuGet package](https://img.shields.io/nuget/v/Bite.svg)](https://nuget.org/packages/Bite)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nBite provides fast bit access with the types `BitReader`, `BitWriter`, and `BitView`.\nIt supports read and write of different memorepresentations in the form of `Lsb0` and `Msb0`.\n\n## Examples\n`BitReader` example:\n```C#\nvar reader = new BitReader(new byte[] { 0x1A }, BitOrder.Lsb0);\n// or var reader = new BitReader(new byte[] { 0xB0 }, BitOrder.Msb0);\nAssert.Equal(0b10u, reader.ReadBits(2));\nAssert.Equal(0b110u, reader.ReadBits(3));\n```\n\n`BitWriter` example:\n```C#\nvar buffer = new ArrayBufferWriter\u003cbyte\u003e();\nvar writer = new BitWriter(buffer, BitOrder.Lsb0);\nwriter.WriteBits(2, 0b10);\nwriter.WriteBits(3, 0b110);\nwriter.Pad(); // Write zeros up to the next byte boundary\nwriter.Flush();\nAssert.Equal(new byte[] { 0x1A }, buffer.WrittenSpan.ToArray()); // Or 0xB0 for BitOrder.Msb0\n```\n\n`BitView` (or equivalently `ReadOnlyBitView`) example:\n```C#\nvar view = new BitView(new byte[] { 0x03, 0x81 }, BitOrder.Lsb0);\n// or var view = new BitView(new byte[] { 0xC0, 0x81 }, BitOrder.Msb0);\nAssert.True(view[0]);\nAssert.True(view[1]);\nAssert.False(view[2]);\n// etc.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmja%2Fbite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frmja%2Fbite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frmja%2Fbite/lists"}