hi
in API docs you write that maximal lengts is up to 0x7FFFFFFFFF. up to including or not ?
in short. length must be:
< 0x7FFFFFFFFF
<= 0x7FFFFFFFFF
?
according to table:
len >= 0x10000000 5 0xF0 and len as four bytes
i understand that i always write 0xF0 as first byte and “len as four bytes” i can not understand.
0x7FFFFFFFFF = 549755813887
let us assume that length must be less that 549755813887. then maximal length is 549755813886. it is IMPOSSIBLE ! to write this integer in 4 bytes !
quote from documentation
Scheme allows encoding of length up to 0x7FFFFFFFFF, only four byte length is supported
consider this example:
In [77]: struct.pack('L', 4294967296)
Out[77]: b'\x00\x00\x00\x00\x01\x00\x00\x00'
In [78]: [x for x in b'\x00\x00\x00\x00\x01\x00\x00\x00']
Out[78]: [0, 0, 0, 0, 1, 0, 0, 0]
In [79]: l = 4294967296
In [80]: (l >>24) & 0xff
Out[80]: 0
In [81]: (l >>16) & 0xff
Out[81]: 0
In [82]: (l >>8) & 0xff
Out[82]: 0
In [83]: l & 0xff
Out[83]: 0
4294967296 = 4294967295 +1. 4294967295 is maximal integer for unsigned long int
do if i send 0xF0 as first byte and and then all 0 i will get on the other side length of 240
so please Mikrotik staff explain it to me how this “upper” limit should be encoded. i assume that 4294967295 is maximal length limit. am i correct ?