Decodes like Plutus's dWord64: at most ten 7-bit groups, least significant first.
Decodes like Plutus's dWord64: at most ten 7-bit groups, least significant first.
The tenth group holds bit 63 only, so it must be 0 or 1 and must not continue. Anything else is a number above 2^64 - 1, which Plutus rejects (for example a constr tag of 2^64), so this throws rather than keep the low 64 bits.
The buffer does not grow, so it must already have room for bitSize bits. Failing that is a defect in this instance rather than a problem with a: an under-estimating bitSize overruns the buffer with an ArrayIndexOutOfBoundsException, and a negative size is rejected by scalus.serialization.flat.EncoderState with an IllegalArgumentException. Use [[FlatCodec.encodeA*]] to get the sizing right.