We only support deserialisation via im.BitSet as the general
case requires going through a proxy to convert the bitmask into
elements that can be read via CanBuildFrom. If you have your
own (possibly compressed) implementation of BitSet you will
need to provide your own format.
We encode the BigInt form as a String using emacs calc-eval
notation (radix is part of the string). See ViaBigDecimalFormat
for a longer discussion about emacs number formats.
This can potentially be used in Emacs using the following (which
will parse the strings into big ints every time it is queried, so
it's not particularly efficient):
We only support deserialisation via
im.BitSet
as the general case requires going through a proxy to convert the bitmask into elements that can be read viaCanBuildFrom
. If you have your own (possibly compressed) implementation ofBitSet
you will need to provide your own format.We encode the
BigInt
form as a String using emacscalc-eval
notation (radix is part of the string). SeeViaBigDecimalFormat
for a longer discussion about emacs number formats.This can potentially be used in Emacs using the following (which will parse the strings into big ints every time it is queried, so it's not particularly efficient):
(require 'calc) (defmath bitsetAnd (bitset i) (logand (lsh 1 i (+ 1 i)) bitset (+ 1 i))) (defun bitsetContains (bitset i) (not (string= "0" (calc-eval "bitsetAnd($, $$)" 'num bitset i))))
(bitsetContains "10#3" 0) ; 't (bitsetContains "10#3" 1) ; 't (bitsetContains "10#3" 2) ; nil (bitsetContains "32#10000000000000001" 0) ; t (bitsetContains "16#10000000000000001" 64) ; t (bitsetContains "16#10000000000000002" 1) ; t (bitsetContains "16#10000000000000002" 64) ; t (bitsetContains "16#10000000000000002" 0) ; nil