{"id":16759416,"url":"https://github.com/cleoold/bitarray","last_synced_at":"2025-04-10T17:14:43.009Z","repository":{"id":126543367,"uuid":"261607273","full_name":"cleoold/bitarray","owner":"cleoold","description":"Bit array (or bit set, bit string, boolean vector, ..., whatever) data structure for Lua.","archived":false,"fork":false,"pushed_at":"2020-07-19T23:21:18.000Z","size":71,"stargazers_count":14,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T15:02:05.457Z","etag":null,"topics":["bitarray","bitset","lua"],"latest_commit_sha":null,"homepage":"https://cleoold.github.io/bitarray/","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/cleoold.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":"2020-05-05T23:42:55.000Z","updated_at":"2024-12-08T08:09:57.000Z","dependencies_parsed_at":"2023-06-17T04:45:47.237Z","dependency_job_id":null,"html_url":"https://github.com/cleoold/bitarray","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleoold%2Fbitarray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleoold%2Fbitarray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleoold%2Fbitarray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleoold%2Fbitarray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cleoold","download_url":"https://codeload.github.com/cleoold/bitarray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261916,"owners_count":21074225,"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":["bitarray","bitset","lua"],"created_at":"2024-10-13T04:08:05.123Z","updated_at":"2025-04-10T17:14:42.999Z","avatar_url":"https://github.com/cleoold.png","language":"C","readme":"![LuaRocks](https://img.shields.io/luarocks/v/cleoold/bitarray?color=blue)\n![dev-build-ci](https://github.com/cleoold/bitarray/workflows/dev-build-ci/badge.svg?branch=master)\n\n# [Bitarray](https://cleoold.github.io/bitarray/)\n\nA simple bit array (or bit set, bit string, boolean vector, ... whatever) data structure for Lua written in pure C.\n\nThe data structure Bitarray stores bits (booleans) in an array in a memory-saving manner internally. \nOne can assign value (false or true) to each element as well as extract values from the array.\n\n* Array bit access using overloaded `[]` operators, concatenation with `..`, as well as `\u0026, |, ~` for bit operations (5.3+).\n* Object-oriented access. Method chaining is available.\n* Conversion between bitarray and unsigned integers (big-endian).\n\n## Install from [luarocks](https://luarocks.org/modules/cleoold/bitarray)\nIt will install the release version.\n```sh\nluarocks install bitarray\n```\n\n## Build the library manually\n```sh\nmake all LUA_VERSION=5.3 # or 5.1, 5.2\n```\nThe generated shared library will reside in `out` folder. Unfortunately, I understand the difficulty of finding the right install path\nfor libraries for different platforms so it is your responsibility to copy the file there. Typically it can be `/usr/local/lib/lua/5.3/`.\n\nFreeBSD users will need to use `gmake`.\n\n## [Documentation](https://cleoold.github.io/bitarray/doc/)\nRequiring [ldoc](http://stevedonovan.github.io/ldoc/), available by issuing\n```sh\nmake doc\n```\nIt is also available at [here](doc/index.html).\n\n## Basic usage\n\nArray access\n```lua\nlocal Bitarray = require'bitarray'\nlocal a = Bitarray.new(10)\na[1] = true\nfor i = 1, #a do print(a[i]) end\n-- true false false false false false false false false false\n```\n\nMethod chaining\n```lua\nlocal b = Bitarray.new(10)\nb:fill(true):set(1, false):set(#b, false)\nprint(b)\n-- Bitarray[0,1,1,1,1,1,1,1,1,0]\n```\n\nStoring integers\n```lua\nlocal c1 = Bitarray.new(16):from_uint16(65535)\nprint(c1)\n-- Bitarray[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]\nlocal c2 = Bitarray.new(16):from_uint16(4015)\nprint(c2)\n-- Bitarray[0,0,0,0,1,1,1,1,1,0,1,0,1,1,1,1]\nlocal c3 = c1 .. c2\nprint(c3)\n-- Bitarray[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,1,0,1,1,1,1]\nprint(c3:at_uint16(1))\n-- 65535\nprint(c3:at_uint16(17))\n-- 4015\nprint(c3:at_uint32(1))\n-- 4294905775\n```\n\n## License\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleoold%2Fbitarray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleoold%2Fbitarray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleoold%2Fbitarray/lists"}