@DrAzzy, you're probably best off using a Uint8Array and wasting 7 out of the 8 bits.
@Stev, not at the moment I'm afraid. It could be an idea though. Someone could make a module based on Java's BigInteger class that used Uint32Array for the data. It should be relatively speedy for simple operations.
I'd wanted to make a UintNArray class that would use arbitrarily-sized integers - for instance I know 1 bit, 4 bit, and 24 bit would be handy. A Uint64Array wouldn't be much use because there'd be no way to get data in or out of it though :(
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@DrAzzy, you're probably best off using a
Uint8Array
and wasting 7 out of the 8 bits.@Stev, not at the moment I'm afraid. It could be an idea though. Someone could make a module based on Java's BigInteger class that used Uint32Array for the data. It should be relatively speedy for simple operations.
I'd wanted to make a
UintNArray
class that would use arbitrarily-sized integers - for instance I know 1 bit, 4 bit, and 24 bit would be handy. A Uint64Array wouldn't be much use because there'd be no way to get data in or out of it though :(