{"id":33939038,"url":"https://github.com/blueglyph/ilog","last_synced_at":"2026-04-08T13:31:18.615Z","repository":{"id":64497920,"uuid":"576021178","full_name":"blueglyph/ilog","owner":"blueglyph","description":"Base 10 and 2 logarithm functions for integer types","archived":false,"fork":false,"pushed_at":"2026-03-21T14:10:36.000Z","size":44,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-22T04:40:02.087Z","etag":null,"topics":["crates-io","integer-arithmetic","logarithm","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/blueglyph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-12-08T20:37:22.000Z","updated_at":"2026-03-21T14:10:39.000Z","dependencies_parsed_at":"2023-02-18T17:01:19.781Z","dependency_job_id":"2167ee0a-4085-44cc-86d7-53e63136a0cf","html_url":"https://github.com/blueglyph/ilog","commit_stats":{"total_commits":33,"total_committers":4,"mean_commits":8.25,"dds":0.303030303030303,"last_synced_commit":"8a258a7393fd6b64718debcea0eea03bed4daa47"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/blueglyph/ilog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueglyph%2Filog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueglyph%2Filog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueglyph%2Filog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueglyph%2Filog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blueglyph","download_url":"https://codeload.github.com/blueglyph/ilog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueglyph%2Filog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31558380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T10:21:54.569Z","status":"ssl_error","status_checked_at":"2026-04-08T10:21:38.171Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["crates-io","integer-arithmetic","logarithm","rust"],"created_at":"2025-12-12T15:10:04.214Z","updated_at":"2026-04-08T13:31:18.606Z","avatar_url":"https://github.com/blueglyph.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ilog\n\n[![crate](https://img.shields.io/crates/v/ilog.svg)](https://crates.io/crates/ilog)\n[![documentation](https://docs.rs/ilog/badge.svg)](https://docs.rs/ilog)\n[![build status](https://github.com/blueglyph/ilog/actions/workflows/master.yml/badge.svg)](https://github.com/blueglyph/ilog/actions)\n[![crate](https://img.shields.io/crates/l/ilog.svg)](https://github.com/blueglyph/ilog/blob/master/LICENSE-MIT)\n\n## Base 10 and 2 logarithm functions for integer types\n\nThe `IntLog` trait defines the following methods:\n\n```rust\nfn log10(self) -\u003e usize\nfn log2(self) -\u003e usize\nfn checked_log10(self) -\u003e Option\u003cusize\u003e\nfn checked_log2(self) -\u003e Option\u003cusize\u003e\n```\n\nThe `log2` and `log10` methods are optimized for the integer width and are\n`[inline]` since the code remains small enough. They typically use constant tables\nthat are only stored once, even if the methods using them are inlined multiple times.\n\nThe **checked** versions of the methods, `checked_log2` and `checked_log10`,\nreturn `None` if the logarithm is undefined for the parameter value, whereas the unchecked\nmethods mentioned above simply panic or return a wrong value.\n\n## Examples\n\n```rust\nuse ilog::IntLog;\n\nlet hundred: u32 = 100;\nassert_eq!(hundred.log10(), 2);\nassert_eq!(u32::log10(99), 1);\n\nlet value: u64 = 256;\nassert_eq!(value.log2(), 8);\nassert_eq!(u64::log2(255), 7);\n\nassert_eq!(u32::checked_log2(63), Some(5));\nassert_eq!(0_u32.checked_log2(), None);\n```\n\n## Compatibility\n\nThe `ilog` crate is tested for rustc 1.65 and greater, on Windows 64-bit and Linux 64/32-bit platforms.\n\nIt doesn't require the `std` library, and supports 16-, 32- and 64-bit architectures.\n\n### Rust versions 1.64 and earlier\n\nNote that in versions 1.64 and earlier, `log`, `log2` and `log10` were nightly experimental `core::num` methods, which were then [renamed](https://github.com/rust-lang/rust/commit/c18f22058bc351224ad2b89e9d352e050275f475)\nrespectively to `ilog`, `ilog2` and `ilog10` in version 1.65 (and are still experimental). This was unknown to the author when the\ncrate was first published.\n\nShould you need to use this crate with earlier versions of rustc, the warnings can be masked with this file directive:\n\n```rust\n    #![allow(unstable_name_collisions)]\n```\n\nor with this directive in front of the function using the methods:\n\n```rust\n    #[allow(unstable_name_collisions)]\n```\n\n## Releases\n\n[RELEASES.md](RELEASES.md) keeps a log of all the releases.\n\n## License\n\nLicensed under [MIT license](https://choosealicense.com/licenses/mit/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueglyph%2Filog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblueglyph%2Filog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueglyph%2Filog/lists"}