how to type cast a number in javascript?
JavaScript
x
3
1
a = (unsigned int)atoi(arg1);
2
b = (unsigned int)atoi(arg2);
3
Assuming that a and b can be signed.
I want to convert a 4 byte signed integer into a 4 byte unsigned integer.
I know there is no such thing as type casting or signed/unsigned in javascript. I am looking for an easy to understand algorithm.
Advertisement
Answer
You can try a = arg1>>>0
, but I’m not sure it will do what you are looking for.
See this question for more details.