Monday, 10 April 2017

Most stable way to convert a 32bit unsigned integer to little endian byte array?

What is the most stable and easiest way to convert a given integer into a four-byte-array with little endian and padding, if needed? Here's an example:

Input value: 714

Output: CA 02 00 00

BTW: An npm module that is capable of doing this would be fine, too.



via Robert

No comments:

Post a Comment