You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Well, Bitset.js has two static functions BitSet.fromHexString and BitSet.fromBinaryString. Currently there is no option for an arbitrary base, but I think it would be a nice addition. Maybe something like BitSet.fromString(str, base)`, what do you think?
Constructor, static function, I am easy either way.. ❤️
I was just looking through your parse(P, val) to see if it was possible.. I got a little confused by the len = 8 for hexidecimal part, so I was unsure what would be needed for passing in 36 or even arbitrary lengths..
The len is just max block length, that is cut out at each time. For base 2 it's 32, for 16 it's 8, for a general base b it would be Math.log(2**32) / Math.log(b). However, this only makes sense for 2^k-bases with the current implementation. And I think implementing a static function is much cleaner, instead of coming up with an arbitrary prefix, such as 36:XYZ or something.
Activity
infusion commentedon Jun 1, 2023
Well, Bitset.js has two static functions
BitSet.fromHexStringand BitSet.fromBinaryString. Currently there is no option for an arbitrary base, but I think it would be a nice addition. Maybe something likeBitSet.fromString(str, base)`, what do you think?WORMSS commentedon Jun 1, 2023
Constructor, static function, I am easy either way.. ❤️
I was just looking through your
parse(P, val)to see if it was possible.. I got a little confused by thelen = 8for hexidecimal part, so I was unsure what would be needed for passing in36or even arbitrary lengths..infusion commentedon Jun 1, 2023
The
lenis just max block length, that is cut out at each time. For base 2 it's 32, for 16 it's 8, for a general basebit would beMath.log(2**32) / Math.log(b). However, this only makes sense for2^k-bases with the current implementation. And I think implementing a static function is much cleaner, instead of coming up with an arbitrary prefix, such as36:XYZor something.