odd_is_odd 0.2.1

A very (not) safe library to check if a number is odd. Based on cve-rs.
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 2 items with examples
  • Size
  • Source code size: 5.81 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.08 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • xnotime/odd_is_odd
    30 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • residualentropy

A very (not) safe library to check if a number is odd. Abuses the same bugs and tricks in cve-rs to transmute the given i8 to a bool without using unsafe.

This relies on a compiler bug, almost certainly doesn't work on all platforms, and is possibly the least reasonable is_odd function you could imagine.

See https://www.youtube.com/watch?v=vfMpIsJwpjU&list=PLzl2iy0KCGD6N93omgPEjgakVYA5t-1oV

Example:

use odd_is_odd::is_odd;
fn main() {
    if (is_odd(69)) {
        println!("on our way to hundreds of thousands of downloads a week!");
    } else {
        println!("who could have guessed, the sketchy library is sketchy");
        assert!(false);
    }
}