{"id":16163817,"url":"https://github.com/sug0/bitmap","last_synced_at":"2025-10-16T11:16:58.357Z","repository":{"id":98037390,"uuid":"108591148","full_name":"sug0/bitmap","owner":"sug0","description":"Bitmap C Library","archived":false,"fork":false,"pushed_at":"2017-10-31T20:49:53.000Z","size":5,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-04T16:58:25.926Z","etag":null,"topics":["array","bitmap","bool","c","cpp","efficient","lib","library","memory","simple","small"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sug0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-10-27T20:09:16.000Z","updated_at":"2025-02-19T22:39:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"38b16fc4-a0c0-4ef6-b5ec-8fb60c1e4910","html_url":"https://github.com/sug0/bitmap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sug0/bitmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sug0%2Fbitmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sug0%2Fbitmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sug0%2Fbitmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sug0%2Fbitmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sug0","download_url":"https://codeload.github.com/sug0/bitmap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sug0%2Fbitmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279182691,"owners_count":26121236,"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","status":"online","status_checked_at":"2025-10-16T02:00:06.019Z","response_time":53,"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":["array","bitmap","bool","c","cpp","efficient","lib","library","memory","simple","small"],"created_at":"2024-10-10T02:44:31.815Z","updated_at":"2025-10-16T11:16:58.340Z","avatar_url":"https://github.com/sug0.png","language":"C","readme":"# Bitmap\n\n![](https://u.sicp.me/pimtD.png)\n\nA bitmap is a data structure that implements an array of booleans in a very\nmemory efficient way; albeit the time complexity of this implementation\nisn't constant, given the fact cpu registers will store the same bytes in\nthem for a prolonged period of time with accesses restricted to the\nsame memory region, this data structure often outperforms others with\nbetter time complexity.\n\n# API\n\n```c\ntypedef struct _bm {\n    uint8_t *bits;\n    size_t max_index;\n} Bitmap_t;\n\nextern void Bitmap_init(Bitmap_t *bm, size_t sz);\nextern uint8_t Bitmap_at(Bitmap_t *bm, size_t index);\nextern void Bitmap_set(Bitmap_t *bm, size_t index, uint8_t set_bit);\nextern void Bitmap_free(Bitmap_t *bm);\n```\n\n# Example usage\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cbitmap.h\u003e\n\nint main(void)\n{\n    Bitmap_t bm;\n\n    /* initialize bitmap with 8 spaces */\n    Bitmap_init(\u0026bm, 8);\n\n    /* set the first bit */\n    Bitmap_set(\u0026bm, 0, 1);\n\n    /* set the third bit */\n    Bitmap_set(\u0026bm, 2, 1);\n\n    /* set the last bit */\n    Bitmap_set(\u0026bm, 7, 1);\n\n    /* print set bits */\n    for (int i = 0; i \u003c 8; i++)\n        putchar((Bitmap_at(\u0026bm, i)) ? '1' : '0');\n\n    putchar('\\n');\n\n    /* free the allocated space in memory */\n    Bitmap_free(\u0026bm);\n\n    return 0;\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsug0%2Fbitmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsug0%2Fbitmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsug0%2Fbitmap/lists"}