{"id":20033095,"url":"https://github.com/ocsmit/bitter","last_synced_at":"2026-07-22T11:03:54.540Z","repository":{"id":180520073,"uuid":"665246257","full_name":"ocsmit/bitter","owner":"ocsmit","description":"Compact/succinct representations for vectors and arrays","archived":false,"fork":false,"pushed_at":"2023-07-31T20:51:48.000Z","size":58,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-30T10:43:52.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ocsmit.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-11T19:13:52.000Z","updated_at":"2025-03-27T01:24:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"3183d03e-5e08-4419-9183-2f87a3eb3037","html_url":"https://github.com/ocsmit/bitter","commit_stats":null,"previous_names":["ocsmit/bitter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ocsmit/bitter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsmit%2Fbitter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsmit%2Fbitter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsmit%2Fbitter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsmit%2Fbitter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocsmit","download_url":"https://codeload.github.com/ocsmit/bitter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocsmit%2Fbitter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35759168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-22T02:00:06.236Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-13T09:44:30.872Z","updated_at":"2026-07-22T11:03:54.515Z","avatar_url":"https://github.com/ocsmit.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bitter\nCompact/succinct representations for vectors and arrays\n\n## BitArray\n\nCompact bit arrays are space effecient representation of the classical array\nas described in \"[Compact Data Structures, a practical approach](https://doi.org/10.1017/CBO9781316588284)\" and its extensive bibliography.\n\nArrays are stored in a compact form by using only the bits needed for each\nelement. E.g. below the array A is shown to be stored using only two uint32\nelements (W). From the compact representation, the values from the original\narray (A) can be read, written, and operated on.\n \n```\n     ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┐\n  A  │  20  │  18  │  22  │  22  │  16  │  21  │  11  │  22  │  21  │  21  │\n     └──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘\n         │      │      │      │      │      │      │      │      │      │\n         │      │      │      │      │      │      │      │      │      │\n         ▼      ▼      ▼      ▼      ▼      ▼      ▼      ▼      ▼      ▼\n     ┌──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┬──────┐\n  B  │10100 │10010 │10110 │10110 │10000 │10101 │01011 │10110 │10101 │10101 │ \n     └──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┴──────┘\n         │      │      │      │      │      │      │      │      │      │\n         │      │      │  B is a virtual bit array │      │      │      │\n         │      │      │      │      │      │      │      │      │      │\n         ▼      ▼      ▼      ▼      ▼      ▼      ▼      ▼      ▼      ▼\n     ┌─────────────────────────────────────────────────────────────────────┐\n  B  │10100  10010  10110  10110  10000  10101  01011  10110  10101  10101 │\n     └─────────────────────────────────────────────────────────────────────┘\n  │                                              ┌────────────────────────┐\n  │   The bits are reordered to provide          │                        │\n  │   0 based indexing from W                 ┌─────┬─────┐               │\n  │                                       MSB │ 010 │ 11  │ LSB           │\n  │                                           └─────┴─────┘               │\n  │                                               A[6] │                  │\n  │    ┌───────────────────────────────────────────────┘                  │\n  ▼  ┌ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┬ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─│─ ┐\n       ▼                                                                  ▼\n  W  │11  10101  10000  10110  10110  10010  10100 │10101  10101  10110  010 │\n      ^^                                                                 ^^^\n     └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┴ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘\n      A[6]                  │                 A[0]   A[9]       │        A[6]\n            ┌───────────────┘                                   │\n            │            ┌──────────────────────────────────────┘\n            ▼            ▼\n     ┌────────────┬────────────┐\n  W  │ 3943389780 │   177586   │\n     └────────────┴────────────┘\n``` \nIt is key to note that the values of A are stored lowest significant first.\nThe same is true for entries which span multiple words. E.g. A[6] in the\nabove visual is split with the 2 lowest sig bits in word 1, and the three\nhighest sig bits in word 2. In word 1 the lowest sig bits of A[6] will be\nthe last bits accessed, while in word 2 the highest sig bits of A[6] will\nbe accessed first.\n\nfor implementation and operation details see:\n  - [bitarr.h](src/bitarr.h)\n  - [bitops.h](src/bitops.h)\n  - [bitarr_io.h](src/bitarr_io.h)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focsmit%2Fbitter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focsmit%2Fbitter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focsmit%2Fbitter/lists"}