bitintr 0.1.18

Portable Bit Manipulation Intrinsics.

Crate bitintr [] [src]

bitintr offers portable bit manipulation intrinsics (@github, @crates.io).

The intrinsics are named after their CPU instruction and organized in modules named after their architecture/instruction set: bitintr::{arch}::{instruction_set}::{instruction_name}.

They are implemented for all integer types except u128/i128. Whether a fallback software implementation is used depends on the integer types involved, the instruction sets supported by the target, and/or whether a nightly or stable compiler is used (some optimizations are only available in nightly).

Example

extern crate bitintr;
use bitintr::x86::bmi2::*;

fn main() {
   // Intrinsics are provided as trait methods:
   let method_call = 1.pdep(0);
   // And as free functions:
   let free_call = pdep(1, 0);
   assert_eq!(method_call, free_call);
}

Modules

arm

ARM assembly instructions.

x86

x86, x86_64, and AMD64 assembly instructions.

Traits

Int

Integer trait used to parametrize algorithms for all integer types.