bytesLength method
Implementation
int? bytesLength(
int value, {
CborLengthEncoding lengthEncdoing = CborLengthEncoding.canonical,
}) {
if (value < 24 && lengthEncdoing == CborLengthEncoding.canonical) {
return null;
} else if (value <= BinaryOps.mask8) {
return NumBytes.one;
} else if (value <= BinaryOps.mask16) {
return NumBytes.two;
} else if (value <= BinaryOps.mask32) {
return NumBytes.four;
} else {
return NumBytes.eight;
}
}