{"id":21944957,"url":"https://github.com/alexanderschuetz97/intsplit","last_synced_at":"2025-03-22T16:15:42.156Z","repository":{"id":241000064,"uuid":"804027895","full_name":"AlexanderSchuetz97/intsplit","owner":"AlexanderSchuetz97","description":"Rust library for splitting various numeric types into their binary component types","archived":false,"fork":false,"pushed_at":"2024-05-21T21:35:51.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T16:55:29.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/AlexanderSchuetz97.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":"2024-05-21T20:18:21.000Z","updated_at":"2024-05-21T21:35:54.000Z","dependencies_parsed_at":"2024-05-21T22:00:58.083Z","dependency_job_id":null,"html_url":"https://github.com/AlexanderSchuetz97/intsplit","commit_stats":null,"previous_names":["alexanderschuetz97/intsplit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderSchuetz97%2Fintsplit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderSchuetz97%2Fintsplit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderSchuetz97%2Fintsplit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexanderSchuetz97%2Fintsplit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexanderSchuetz97","download_url":"https://codeload.github.com/AlexanderSchuetz97/intsplit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244982058,"owners_count":20542300,"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":[],"created_at":"2024-11-29T04:17:29.747Z","updated_at":"2025-03-22T16:15:42.135Z","avatar_url":"https://github.com/AlexanderSchuetz97.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# intsplit\nRust library for splitting numeric types into their binary component arrays.\n\n### Example\n```rust\nuse intsplit::*;\n\n#[test]\nfn example() {\n    let number : u32 = 0x0A0B0C0Du32;\n    let u16_components: [u16; 2] = number.as_u16_array();\n    assert_eq!([0x0C0Du16, 0x0A0Bu16], u16_components);\n}\n```\n\n### Implemented transmutes\nThis library uses no unsafe code (only in tests) to implement the transmutes.\nThe rust compiler will recognize that all these operations are essentially transmutes \nand optimize similarly (on optimized builds)\n\n#### u16/i16:\n- as_i8_array -\u003e [i8; 2]\n\n#### u32/i32/f32:\n- as_i8_array -\u003e [i8; 4]\n- as_i16_array -\u003e [i16; 2]\n- as_u16_array -\u003e [u16; 2]\n\n#### u64/i64/f64:\n- as_i8_array -\u003e [i8; 8]\n- as_i16_array -\u003e [i16; 4]\n- as_u16_array -\u003e [u16; 4]\n- as_i32_array -\u003e [i32; 2]\n- as_u32_array -\u003e [u32; 2]\n- as_f32_array -\u003e [f32; 2]\n\n\n#### u128/i128:\n- as_i8_array -\u003e [i8; 16]\n- as_i16_array -\u003e [i16; 8]\n- as_u16_array -\u003e [u16; 8]\n- as_i32_array -\u003e [i32; 4]\n- as_u32_array -\u003e [u32; 4]\n- as_f32_array -\u003e [f32; 4]\n- as_i64_array -\u003e [i64; 2]\n- as_u64_array -\u003e [u64; 2]\n- as_f64_array -\u003e [f64; 2]\n\n### Beware of endianness\nPlease note that the result is always equivalent to transmuting the to_ne_bytes() result to the respective array.\nThe example provided in this readme will not work on big endian targets as that would swap the 2 u16 values in the assert statement,\njust like mem::transmute - ing the result of to_ne_bytes() would not yield the same result on little and big endian. \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexanderschuetz97%2Fintsplit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexanderschuetz97%2Fintsplit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexanderschuetz97%2Fintsplit/lists"}