Crate bitintr [] [src]

bitintr offers portable bit manipulation intrinsics (@github,

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).


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);



ARM assembly instructions.


x86, x86_64, and AMD64 assembly instructions.



Integer trait used to parametrize algorithms for all integer types.