JA:
それはのようにアレイ状に存在するUint32Array(署名済みバージョンがあるInt32Array)が、私はあなたがこの値にアクセスしたら、それは通常のJSの数になると言われました。
let number = (new Unit32Array(1)).fill(1)[0];
どこ変数の数は、二重、あなたはそれが32ビット符号付き整数に変換され、ビット演算を行う一度として実装されています。
あなたが実際に、アレイ内の未署名の表現を使用することができる場合、私はそれが通常の数で飛び出し、あなたがそれにアクセスすなわちたら、Unit32Arrayの目的を得ることはありませんか?
function analyze () {
// let test = 2147483647; // max 32 bit integer
// let test = -2147483647; // min 32 bit integer
for(let place = 0; place < 32; place++){
let power2 = Math.pow(2, place);
let bit = test & power2;
console.log(place, bit)
}
}
analyze();
/*
2^0 is 1 is 0x1
2^1 is 2
2^2 is 4
2^3 is 8
.
.
2^31 is 2147483648
2^32 is 4294967296
*/
ボブ :
ほとんどの人は、JavaScriptがビット単位の演算でうまく動作することを認識していません。あなたはとペアリングする必要が配列バッファが。
let buffer = new ArrayBuffer(16); // create a buffer of length 16
let view = new Uint32Array(buffer); // treat buffer as a sequence of 32-bit integers