{"id":16657507,"url":"https://github.com/whatyouhide/small_ints","last_synced_at":"2025-09-07T01:33:51.674Z","repository":{"id":34028520,"uuid":"37787539","full_name":"whatyouhide/small_ints","owner":"whatyouhide","description":"varint and ZigZag encoding/decoding for Erlang","archived":false,"fork":false,"pushed_at":"2016-05-16T13:29:55.000Z","size":4,"stargazers_count":12,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-12T03:33:02.596Z","etag":null,"topics":["erlang","varint","zigzag"],"latest_commit_sha":null,"homepage":"","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whatyouhide.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}},"created_at":"2015-06-20T22:00:32.000Z","updated_at":"2024-10-03T10:46:07.000Z","dependencies_parsed_at":"2022-07-14T02:30:39.941Z","dependency_job_id":null,"html_url":"https://github.com/whatyouhide/small_ints","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/whatyouhide/small_ints","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fsmall_ints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fsmall_ints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fsmall_ints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fsmall_ints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whatyouhide","download_url":"https://codeload.github.com/whatyouhide/small_ints/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whatyouhide%2Fsmall_ints/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266430676,"owners_count":23927167,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["erlang","varint","zigzag"],"created_at":"2024-10-12T10:00:46.035Z","updated_at":"2025-07-22T05:05:07.773Z","avatar_url":"https://github.com/whatyouhide.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# small_ints\n\n`small_ints` is an Erlang module that can help you deal with encoding and\ndecoding of integers using the varint and ZigZag algorithms described in the\n[\"Encoding\" section][docs-protobuf] of Google Protocol Buffer's docs.\n\n## Building\n\n    $ rebar3 compile\n\n### Varint\n\nBasically, you use a variable number of bytes to represent a positive\ninteger. You can encode varints to binaries and decode them from binaries like\nthis:\n\n```erlang\nsmall_ints:encode_varint(5).    %=\u003e \u003c\u003c5\u003e\u003e\nsmall_ints:encode_varint(1034). %=\u003e \u003c\u003c138,8\u003e\u003e\n\nsmall_ints:decode_varint(\u003c\u003c5,\"foo\"\u003e\u003e). %=\u003e {5, \u003c\u003c\"foo\"\u003e\u003e}\nsmall_ints:decode_varint(\u003c\u003c138,8\u003e\u003e). %=\u003e {1034, \u003c\u003c\u003e\u003e}\n```\n\n### ZigZag\n\nThe ZigZag algorithm is used to encode small positive *and negative* numbers\nwith a small number of bytes.\n\n```erlang\nsmall_ints:encode_zigzag(1).  %=\u003e 2\nsmall_ints:encode_zigzag(-5). %=\u003e 9\n\nsmall_ints:decode_zigzag(6).  %=\u003e 3\n```\n\n### Other stuff\n\n`small_ints` also provides two utility functions which just combine the varint\nand ZigZag algorithms:\n\n* `small_ints:decode_zigzag_varint/1`: decodes the next varint from the given\n  binary and then decodes it with ZigZag\n* `small_ints:encode_zigzag_varint/1`: encodes the given integer with ZigZag,\n  then encodes the result with varint\n\n## License\n\nMIT License \u0026copy; 2015, Andrea Leopardi\n\n\n[docs-protobuf]: https://developers.google.com/protocol-buffers/docs/encoding\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhatyouhide%2Fsmall_ints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhatyouhide%2Fsmall_ints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhatyouhide%2Fsmall_ints/lists"}