#changed it to Math.pow and stuff because
Explore tagged Tumblr posts
Text
well that was a fun exercise.
i have this old function made for reading multiple bytes in an array as one big number, and not only is it a total mess, but it requires bytes to be passed in as strings in a 0x00 format, which is just... really weird, don't ask me how i landed on this months and months ago
well now i have this instead
instead of messing with converting strings and stuff, everything is numbers from the start, lol. and it can handle little endian if i want! the thing i'm actually using this for is big endian 99% of the time but still, why not. i feel like i learned a good bit doing that. that was fun
whee!
#ayano was here#ayano.txt#programming#originally i wrote this with bitwise operators but#changed it to Math.pow and stuff because#js's bitwise stuff defaults to 32bit signed integers and it was just easier to do it this way instead as a result
7 notes
·
View notes