
To get started, you can perform basic text replacement on your project.Īnd then follow any compiler errors that arise. Other collections that test a yes/no property of a number or replacing If explicit vectorization is important to you, pleaseĮxample uses might be implementing a Sieve of Eratosthenes to store primes, or Instructions in its default work, its codegen should be a good candidate forĪutovectorization in LLVM. While bitvec does not attempt to take advantage of SIMD or other vectorized The default behavior is optimized for fast memoryĪccess and simple codegen, and can compact or Vec with minimal

In addition, the presence of aĭynamic allocator enables the BitBox and BitVec buffer types, which can be Integer memory) or the BitArray value type. It is never held directly, but only by references (created by borrowing The BitSlice type is a view that alters the behavior of a borrowed memory Furthermore, bit-slices can store // ordinary integers: let eight = set( 0, true) Īssert!( bits) // a assert!( bits) // b assert!( bits) // c assert!( bits) // d // `BitSlice` is accessed by reference, // which means it respects NLL styles.

but now a, b, c, and d own a nibble! let (( a, b), ( c, d)) = ( And they are writable! let mut data = Unsigned integers (scalar, array, // and slice) can be borrowed. All data-types have macro // constructors. Limiting minor-version constraint like "~1.0".įirst, depend on it in your Cargo manifest: If you have a pinned Rust toolchain, you should depend on bitvec with a Now that bitvec is at 1.0, it will only raise MSRV in minor-edition releases. Standard library to actually have the symbols present, doing so may not require However,Īs most of its functionality is a reïmplementation that does not require the

#Bitsafe reviews code
It compiles to the same, or even better, object code than you Theīit-stream behavior provides the logic necessary for C-style structuralīitfields, and syntax sugar for it can be found in deku.īitvec enables you to write code for bit-addressed memory that is simple,Įasy, and fast. Rust idioms and in the most capable, performant, implementation possible. Using shift and mask operations that are likely familiar to anyone who has doneīitvec brings the capabilities of C++’s compact bool storage and Erlang’sĭecomposable bit-streams to Rust, in a package that fits in with your existing This means that when programmers wish to operate on individualīits within a byte of memory or a word of register, they have to do so manually, Processors operate on register words, which are typically four to eight bytes,

IntroductionĬomputers do not operate on bits. If you need to view memory as bit-addressed instead of byte-addressed, thenīitvec is the fastest, most complete, and Rust-idiomatic crate for you. Integer storage, like binaries in Erlang. One-bit-per- bool storage, similar to std::bitset andĪdditionally, it allows a memory region to be divided into arbitrary regions of Standard-library data structures (slices, arrays, and vectors of bool) to use Bitvec provides a foundational API for bitfields in Rust.
