Closed Sword-Smith closed 1 year ago
To my surprise, this is how BFieldCodec
already seems to behave as unsafe lists do in tasm-lib
. So maybe we're already completely compatible?
a vector of one digest, BFieldCodec-encoded:
1, 01902878943270888528, 07902863166419500187, 09789659787709908841, 16764095073303014797, 13000230451442831213
a vector of three digests, BFieldCodec-encoded:
3, 05766296886603018513, 01859705052360574723, 10345643265792401236, 09094205152803709716, 12242540343919358588, 01197565021873702736, 18366731706372651031, 10980558966005654359, 17074550821154146333, 02210137659387184658, 15755658189453237187, 00526061026319670316, 13688844957118845124, 05652090378287103615, 03055817179449329576
Currently a list lives in memory as
length_in_elements
, followed by capacity (when using safe lists), followed by the list elements. ButBFieldCodec::encode
prepends a list withlength_in_words
which is different whenever the element type is of size larger than one.One option is to change the list implementation in
tasm_lib
to use thelength_in_words = length_in_elements * element_size =
instead. That would add somemul
div
/inverse
overhead though.