Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move arithmetic to its own crate #17

Closed
myrrlyn opened this issue Jun 21, 2019 · 3 comments
Closed

Move arithmetic to its own crate #17

myrrlyn opened this issue Jun 21, 2019 · 3 comments
Assignees

Comments

@myrrlyn
Copy link
Collaborator

myrrlyn commented Jun 21, 2019

As mentioned in #16, the default numeric arithmetic implementations may not be suitable for all use cases of bit sequences. Furthermore, the core crate does not include suitability as a numeric type in its design goals – the minimum product is a sequence of raw bits, with no further semantic information held in the sequence itself.

This issue proposes moving all numeric behavior out of the core crate, into a separate sibling crate (bitvec_arith? bitvec_num?) with wrapper types over BitSlice and BitVec that perform numeric arithmetic using the underlying sequences as the n-ary number storage.

@myrrlyn myrrlyn self-assigned this Jun 21, 2019
@myrrlyn
Copy link
Collaborator Author

myrrlyn commented Jun 21, 2019

The implementation of AddAssign is currently a ripple-carry adder. This is a strictly linear O(n) operation in the length of the addends, and is the worst possible implementation of numeric addition. Use of a different addition algorithm, such as CLA trees, or the Kogge-Stone family, would allow for faster performance and enable parallelization.

@myrrlyn
Copy link
Collaborator Author

myrrlyn commented Feb 20, 2020

Issue #50 notes that comparison is lexicographic, not arithmetic. This makes for incorrect behavior when performing arithmetic governed by comparison!

This problem raises the severity of this issue. As such, I plan to remove the arithmetic implementations from this crate this year, ideally in the next release.

@myrrlyn
Copy link
Collaborator Author

myrrlyn commented Sep 1, 2020

Nobody has asked about varint support in the crate, so I'm going to close this.

@myrrlyn myrrlyn closed this as completed Sep 1, 2020
wcampbell0x2a added a commit to wcampbell0x2a/bitvec that referenced this issue Sep 1, 2020
Signed-off-by: wcampbell <wcampbell1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant