Closed dderevjanik closed 2 years ago
You can't (afaik) unless doing the trick in the post you link
var decimal = (buffer[0] << 16) + (buffer[1] << 8) + buffer[2];
You could get the buffer from the IOBuffer.buffer
and then update the offset.
That is of BE and invert it for LE.
I had a similar problem parsing uavcan packets
If the data are not too big and time is not super critical you can convert your data to a BigInteger and then use
https://github.com/lpatiny/uavcan/blob/master/src/data/parser/util/parseInt.js
Hello, is it possible to read int with non-standard bytes length? e.g. 4
Similar to https://stackoverflow.com/questions/30911185/javascript-reading-3-bytes-buffer-as-an-integer