728x90

자바스크립트에서 숫자는 모두 Number 타입으로 Double로 취급된다.

 

비트 연산자 (Bitwise Operator) >>> 사용 시 Unsigned 32-bit Integer로 변환되기 때문에

 

다음과 같이 h를 Unsigned 32-bit Integer로 변환할 수 있다.

 

h >>>= 0;

 

Reference:

http://stackoverflow.com/questions/1908492/unsigned-integer-in-javascript

 

Unsigned Integer in Javascript

I'm working on a page that processes IP address information, but it's choking on the fact that integers are signed. I am using bitwise operators to speed it up, but the 64th bit (signed/unsigned fl...

stackoverflow.com

 

 

하지만 객체를 이용해서 Uint32Arrary 를 쓰는게 더 좋다.

+ Recent posts