{"id":16389742,"url":"https://github.com/yuce/droaring","last_synced_at":"2026-01-31T18:31:43.731Z","repository":{"id":146806234,"uuid":"128586623","full_name":"yuce/droaring","owner":"yuce","description":"Roaring Bitmaps for D","archived":false,"fork":false,"pushed_at":"2018-12-15T18:41:08.000Z","size":187,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T07:50:42.780Z","etag":null,"topics":["bitmap","dlang","roaring-bitmaps"],"latest_commit_sha":null,"homepage":null,"language":"D","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuce.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":"2018-04-08T02:02:41.000Z","updated_at":"2022-09-17T09:26:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"66814ac9-e788-41d3-aefd-2ce583307f0a","html_url":"https://github.com/yuce/droaring","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/yuce/droaring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuce%2Fdroaring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuce%2Fdroaring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuce%2Fdroaring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuce%2Fdroaring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuce","download_url":"https://codeload.github.com/yuce/droaring/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuce%2Fdroaring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28949370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"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":["bitmap","dlang","roaring-bitmaps"],"created_at":"2024-10-11T04:34:12.136Z","updated_at":"2026-01-31T18:31:43.711Z","avatar_url":"https://github.com/yuce.png","language":"D","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://travis-ci.org/yuce/droaring\"\u003e\u003cimg src=\"https://api.travis-ci.org/yuce/droaring.svg?branch=master\"\u003e\u003c/a\u003e\n\u003ca href='https://coveralls.io/github/yuce/droaring?branch=master'\u003e\u003cimg src='https://coveralls.io/repos/github/yuce/droaring/badge.svg?branch=master' alt='Coverage Status' /\u003e\u003c/a\u003e\n\n\u003cimg src=\"https://github.com/yuce/yuce.github.io/blob/master/roaring.jpg\" style=\"float: right\" align=\"right\" height=\"256\" width=\"256\"\u003e\n\n# Experimental D Roaring Bitmaps Library\n\n[Roaring Bitmaps](http://roaringbitmap.org) are compressed bit arrays which can store a huge amount of bits in a space efficient manner. The bitmap is organized so that adding/removing bits is very fast and don't require unpacking the whole bitmap. You can use bit arrays for efficient set operations.\n\nCheck out [Pilosa](https://www.pilosa.com) for an open source distributed index which uses roaring bitmaps.\n\nThis library wraps [CRoaring](https://github.com/RoaringBitmap/CRoaring).\n\nThanks to all [Contributors](CONTRIBUTORS.md).\n\n## News\n\n* Version *0.2.1* (2018-12-15)\n    * `Bitmap.addRange`, `containsRange`, `lengthInRange` methods by [Justin Whear](https://github.com/jwhear).\n\n* Version *0.2.0* (2018-12-08)\n    * `Bitmap.dup` property and `Bitmap.andNot` method by [Justin Whear](https://github.com/jwhear)\n    * More `Bitmap.opOpAssign` overloads by [Justin Whear](https://github.com/jwhear)\n    * Updated to [CRoaring](https://github.com/RoaringBitmap/CRoaring) 0.2.58 by [Justin Whear](https://github.com/jwhear)\n\n* Version *0.1.0* (2018-04-08)\n    * Initial version\n\n## Limitations\n\n* Bitmap size is (*currently*) limited to `uint.max`, which is `2^^32 - 1`. This is a limitation of CRoaring. See: https://github.com/RoaringBitmap/CRoaring/issues/1\n\n## Requirements\n\n* A recent D compiler. Tested with DMD v2.079.0, LDC 1.8.0 and GDC v2.068.2_gcc6.\n* C compiler with C11 support.\n* Tested on Linux, FreeBSD, MacOS and Windows (only with 64bit).\n\n## Install\n\n### Using DUB\n\nAdd `roaring` to your DUB dependencies. E.g.:\n```json\n{\n    \"name\": \"roar\",\n    \"description\": \"A minimal D application.\",\n    \"dependencies\": {\n        \"roaring\": {\n            \"version\": \"0.2.0\"\n        }\n    }\n}\n```\n\n### Without DUB\n\nAssuming you've built the library and `$DROARING_HOME` points to the DRoaring directory:\n\n```\ndmd your_source.d $DROARING_HOME/ext/roaring.o -L-L$DROARING_HOME -L-lroaring -I$DROARING_HOME/source\n```\n\n## Example\n```d\nvoid main()\n{\n    import std.stdio : writefln, writeln;\n    import roaring.roaring : Bitmap, bitmapOf;\n\n    // create a new roaring bitmap instance\n    auto r1 = new Bitmap;\n\n    // add some bits to the bitmap\n    r1.add(5);\n\n    // create from an array\n    auto ra = bitmapOf([1, 2, 3]);\n\n    // create from a range\n    import std.range : iota;\n    assert(bitmapOf(0, 1, 2, 3) == bitmapOf(4.iota));\n\n    // create a new roaring bitmap instance from some numbers\n    auto r2 = bitmapOf(1, 3, 5, 15);\n\n    // check whether a value is contained\n    assert(r2.contains(5));\n    assert(5 in r2); // r2 contains 5\n    assert(99 !in r2); // r2 does not contain 99\n\n    // get minimum and maximum values in a bitmap\n    assert(r2.minimum == 1);\n    assert(r2.maximum == 15);\n\n    // remove a value from the bitmap\n    r2.remove(5);\n    assert(!r2.contains(5));\n\n    // compute how many bits there are:\n    assert(3 == r2.length);\n\n    // check whether a bitmap is subset of another\n    const sub = bitmapOf(1, 5);\n    const sup = bitmapOf(1, 2, 3, 4, 5, 6);\n    assert(sub in sup);\n\n    // iterate on a bitmap\n    const r3 = bitmapOf(1, 5, 10, 20);\n    ulong s = 0;\n    foreach (bit; r3) {\n        s += bit;\n    }\n    assert(s == 36);\n\n    // iterate on a bitmap and index\n    foreach(i, bit; r3) {\n        writefln(\"%d: %d\", i, bit);\n    }\n\n    import roaring.roaring : readBitmap, writeBitmap;\n    // serialize the bitmap\n    char[] buf = writeBitmap(r3);\n    // deserialize from a char array\n    const r3Copy = readBitmap(buf);\n    assert(r3 == r3Copy);\n\n    // find the intersection of bitmaps\n    const r4 = bitmapOf(1, 5, 6);\n    const r5 = bitmapOf(1, 2, 3, 4, 5);\n    assert((r4 \u0026 r5) == bitmapOf(1, 5));\n    // find the union of bitmaps\n    assert((r4 | r5) == bitmapOf(1, 2, 3, 4, 5, 6));\n\n    const r6 = bitmapOf(0, 10, 20, 30, 40, 50);\n    // get the bit for the index\n    assert(20 == r6[2]);\n    // slice a bitmap\n    assert(bitmapOf(30, 40, 50) == r6[3..$]);\n\n    // convert the bitmap to a string\n    writeln(\"Bitmap: \", r6);\n    import std.conv : to;\n    assert(\"{0, 10, 20, 30, 40, 50}\" == to!string(r6));\n\n    // the bit range!\n    import std.algorithm : filter, sum;\n    import roaring.roaring : range, BitRange;\n    // sum of bits in r6 which are bit % 20==0\n    assert(60 == r6.range.filter!(b =\u003e b % 20 == 0).sum);\n\n    // if your bitmaps have long runs, you can compress them\n    auto r7 = bitmapOf(1000.iota);\n    writeln(\"size before optimize = \", r7.sizeInBytes);\n    r7.optimize();\n    writeln(\"size after optimize = \", r7.sizeInBytes);\n\n    // copy a bitmap (uses copy-on-write under the hood)\n    const r8 = r7.dup;\n    assert(r8 == r7);\n}\n```\n\n## Build\n\n### Using DUB\n\nUsing default D compiler:\n\n```\ndub build\n```\n\nSpecifying the D compiler:\n```\ndub build --compiler=$LDC_HOME/bin/ldc2\n```\n\n### Using make\n\nUsing default D compiler:\n\n```\nmake\n```\n\nSpecifying the D compiler:\n```\nmake DMD=$LDC_HOME/bin/ldc2\n```\n\n## Running Tests\n\n```\ndub test\n```\n\n## License\n\n* `ext/roaring.c` and `ext/roaring.h` were generated from [CRoaring](https://github.com/RoaringBitmap/CRoaring/) source. Copyright 2016 The CRoaring authors. See the [LICENSE](https://github.com/RoaringBitmap/CRoaring/blob/master/LICENSE).\n\n* D Wrapper for CRoaring: Copyright 2018 Yüce Tekol. See the [LICENSE](https://github.com/yuce/droaring/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuce%2Fdroaring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuce%2Fdroaring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuce%2Fdroaring/lists"}