{"id":37140192,"url":"https://github.com/felix/bitarray","last_synced_at":"2026-01-14T16:25:48.098Z","repository":{"id":66457221,"uuid":"197278848","full_name":"felix/bitarray","owner":"felix","description":"[mirror] BitArray, a bit array with packing.","archived":false,"fork":false,"pushed_at":"2021-07-22T07:23:48.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T16:39:29.236Z","etag":null,"topics":["array","array-manipulations","bits","go"],"latest_commit_sha":null,"homepage":"https://src.userspace.com.au/bitarray/about","language":"Go","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/felix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-16T22:55:46.000Z","updated_at":"2021-07-22T07:22:32.000Z","dependencies_parsed_at":"2023-02-20T23:31:05.599Z","dependency_job_id":null,"html_url":"https://github.com/felix/bitarray","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/felix/bitarray","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felix%2Fbitarray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felix%2Fbitarray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felix%2Fbitarray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felix%2Fbitarray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/felix","download_url":"https://codeload.github.com/felix/bitarray/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/felix%2Fbitarray/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28425811,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T15:24:48.085Z","status":"ssl_error","status_checked_at":"2026-01-14T15:23:41.940Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["array","array-manipulations","bits","go"],"created_at":"2026-01-14T16:25:47.355Z","updated_at":"2026-01-14T16:25:48.090Z","avatar_url":"https://github.com/felix.png","language":"Go","readme":"# BitArray\n\nThis package provides a bit array structure with sub-byte methods like packing\nand shifting for arrays of bits of arbitrary length.\n\nThis is not useful for set operations. It facilitates encoding data that is not\nnecessarily aligned to 8 bits. It was originally designed to cater to the\npacked encoding required for the ISO/IEC 20248 digital signature format.\n\n## Usage\n\n```go\nimport (\n\t\"fmt\"\n\n\t\"src.userspace.com.au/bitarray\"\n)\n\nfunc main() {\n\tba := \u0026bitarray.BitArray{}\n\n\t// Add single bits, never truncated\n\tba.AddBit(1)\n\tba.AddBit(0)\n\tba.AddBit(1)\n\tfmt.Println(ba.Len()) // =\u003e 3\n\tfmt.Printf(\"%08b\\n\", ba.Bytes()) // =\u003e [10100000]\n\n\t// Add with truncated leading padding\n\tba.Add(5)\n\tfmt.Printf(\"%08b\\n\", ba.Bytes()) // =\u003e [10110100]\n\n\t// Add with fixed length\n\tba.AddN(5, 10)\n\tfmt.Printf(\"%08b\\n\", ba.Bytes()) // =\u003e [10110100 00000101]\n\n\tr := bitarray.NewReader(ba)\n\tvar out uint\n\tr.ReadBits(\u0026out, 16)\n\tfmt.Printf(\"%08b\\n\", out) // =\u003e 1011010000000101\n\n\tba.ShiftL(2)\n\tfmt.Println(ba.String()) // =\u003e [11010000 000101--]\n\n\tba2, _ := ba.Slice(9, 6)\n\tfmt.Println(ba2.String()) // =\u003e [000101--]\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelix%2Fbitarray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffelix%2Fbitarray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffelix%2Fbitarray/lists"}