JavaScript's largest value is 2^53 [Ref: https://www.ecma-international.org/ecma-262/5.1/#sec-8.5].
Hence, you can't represent integers/unsigned integers that are 64 bits and above through the parseInt
method.
Solution: I recommend forcing developers to use BigNumber [https://github.com/indutny/bn.js/]. This is safer and can handle larger numbers.
In addition, you will also have to do checks to check if an integer can be casted into unsigned
and vice-versa. For example, toUint32(-1)
should raise an Error.
On another note, the default value should raise an error if the type cannot be found.
default:
ret[vname] = value;
break;