Giter VIP home page Giter VIP logo

Comments (2)

myrrlyn avatar myrrlyn commented on June 7, 2024

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.

myrrlyn avatar myrrlyn commented on June 7, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.