Consider using uint64 / int64 instead of big.Int in VINT
Closed this issue · 0 comments
Element ID
The theoretical maximum byte length of Element ID is infinite. Its length is defined by EBMLMaxIDLength
. ebml.xml defines EBMLMaxIDLength
as type="uinteger" range=">=4" default="4"
.
In reality it is not likely to have a EBMLMaxSizeLength
greater than 4. The library could handle values up to 7 and if this value is greater than 7 the library could return an error saying the EBML document cannot be parsed by this lib.
In case EBMLMaxSizeLength
has a value of 7, the maximal value it can contain is 2^56-2
which fits into uint64
and int64
as well.
Element Data Size
The theoretical maximum byte length of Element Data Size is infinite. Its length is defined by EBMLMaxSizeLength
. ebml.xml defines EBMLMaxSizeLength
as type="uinteger" range="not 0" default="8"
. The library uses big.Int
to be compatible with this specification.
In reality it is not likely to have a EBMLMaxSizeLength
greater than 8. In case this value is greater than 8 the library could return an error saying the EBML document cannot be parsed by this lib.
The value of EBMLMaxSizeLength
has a direct connection with VINTMAX
. VINTMAX
limits the value of known Element Data Sizes.
In case EBMLMaxSizeLength
has a value of 8, the value of VINTMAX
is 2^56-2
which fits into uint64
and int64
as well.