Comments (2)
I am reluctant, but not unwilling, to add a nightly
feature gate, but it would receive less maintenance than the stable items.
A double-pointer iterator is something I've been vaguely contemplating since seeing its use in the [T]
iterators. It can be represented as follows:
#[repr(C)]
struct Iter<O: BitOrder, T: BitStore> {
// address of the base element
front: *const T,
// address of the element containing the tail marker
back: *const T,
// semantic count of the first live bit
head: BitIdx<T::Mem>,
// semantic count of the first dead bit
tail: BitTail<T::Mem>,
}
This is easy to construct from a BitPtr<T>
:
impl<T: BitStore> BitPtr<T> {
fn to_iter(self) -> Iter<T> {
let (base, head, bits) = self.raw_parts();
let (elts, tail) = head.span(bits);
Iter {
front: base,
back: base.offset(elts),
head,
tail,
}
}
}
I'll need to come up with a good way to test whether the (*const T, BitIdx<T::Mem>)
bit pointer has reached the (*const T, BitTail<T::Mem>
tail marker in order to handle termination, but access to memory is just BitAccess::get(&*(front as *const T::Access), head)
or construction of a BitMut<T>
from (front, head, 1)
. Pretty straightforward.
from bitvec.
Version 0.18 uses double-pointer iteration, and demonstrates non-trivial acceleration. Thank you for the suggestion, and your work earlier this year! It's really helped me improve the library.
from bitvec.
Related Issues (20)
- `BitXorAssign<&BitSlice>` is unexpectedly slow. HOT 1
- Support riscv32im in bitvec
- v0.22.3 is broken due to funty 1.2 yank
- Feature Request: `iter_ones_from` HOT 1
- Broken doc links HOT 2
- Why it is 6 but not 3? HOT 1
- Is there a way to read file to `BitSlice`?
- Equivalent BitVec<u8> produce different Vec<u8> HOT 1
- Bug?: BitVec's .as_bool() function returns negated value instead of the actual bit value HOT 2
- Bug: as_raw_slice() returns wrong value
- Compilation errors due to missing atomics even though `atomic` feature is not enabled HOT 3
- Ordering bug comparing Vec & Slice
- [Question] Is is possible to use BitArray with const generics? HOT 1
- `bitarr![const ...]` throws mismatched types HOT 1
- Bug (?): load() loads wrong value
- Can I implement `TrustedLen` for wrapper of `Iter` and `BitValIter`?
- Can ends_with be optimized further?
- Use #[track_caller] attribute HOT 2
- Dead documentation link HOT 4
- `to_bitvec` and related functions returning invalid values HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitvec.