-
Notifications
You must be signed in to change notification settings - Fork 25
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
Simplify bitfield format; size, ordering, etc. #54
Comments
/cc @warpfork |
Changed the title of this after playing a bit with the format. Dropping some thoughts here as I explore this. The bitfield at the moment uses a The maximum length of the bitfield should be Filecoin only uses a bitWidth of 5, so that's 32-bits, or 4-bytes needed to represent the bitfield. Some thoughts about this format:
I don't have a strong opinion here yet, would like to hear others' thoughts. My personal preference would be for it to be stable and consistent, with the bitfield byte array in CBOR being exaclty @warpfork @Stebalien @anorth thoughts? |
Thoughts in no particular order:
So, I haven't estimated how much work it would be to change this, but I think I broadly agree with your preference for the bitfield byte array to be exactly |
@warpfork For comparison, we don't use Java's BigInteger in our implementation, but BitSet which is much simpler and I think inline with go's big.Int? |
I agree with just storing the entire bitmap. |
Storing the bitfield explicitly sgtm. |
In ipld/specs#282 I'm claiming that the
map
(bitfield
) is addressed here in the same way as the specification, and therefore the reference implementation for the IPLD HashMap. The spec currently doesn't use super clear language about how you address a specific bit of a byte array but it's assuming standard LE addressing where "readingindex
bit of the byte array" implies a certain ordering that you can apply masks to. I don't know how the Go bitfield works but it would be good to verify if the bit checking used here matches operations on the same byte array as used here https://github.com/rvagg/iamap/blob/master/bit-utils.js and if not, document exactly how it works so implementers can be crystal clear.The text was updated successfully, but these errors were encountered: