Baseline Widely available
Atomics.sub()
ì ì ë©ìëë ë°°ì´ìì 주ì´ì§ ìì¹ì 주ì´ì§ ê°ì¼ë¡ 빼기 ì°ì°ì ìííê³ í´ë¹ í¬ì§ì
ì 기존 ê°ì ë°íí©ëë¤. ì´ ìí 믹 ì°ì°ì ìì ë ê°ì´ ì°ì´ê¸° ì ê¹ì§ ë¤ë¥¸ ì°ê¸° ì°ì°ì´ ì¼ì´ëì§ ììì ë³´ì¥í©ëë¤.
// Create a SharedArrayBuffer with a size in bytes
const buffer = new SharedArrayBuffer(16);
const uint8 = new Uint8Array(buffer);
uint8[0] = 7;
// 7 - 2 = 5
console.log(Atomics.sub(uint8, 0, 2));
// Expected output: 7
console.log(Atomics.load(uint8, 0));
// Expected output: 5
구문
Atomics.sub(typedArray, index, value)
매ê°ë³ì
typedArray
ì ìí íìí ë°°ì´. Int8Array
, Uint8Array
, Int16Array
, Uint16Array
, Int32Array
, Uint32Array
, BigInt64Array
, BigUint64Array
ì¤ íë.
index
value
를 ì°¨ê°í typedArray
ì ì¸ë±ì¤ì
ëë¤.
value
ì°¨ê°í ê°(ì«ì)ì ëë¤.
주ì´ì§ ìì¹(typedArray[index]
)ì ìì ê°.
typedArray
ê° íì©ë ì ìíì´ ìë ê²½ì° TypeError
ê° ë°ìí©ëë¤.index
ê° typedArray
ì ë²ì를 ë²ì´ë ê²½ì° RangeError
ê° ë°ìí©ëë¤.const sab = new SharedArrayBuffer(1024);
const ta = new Uint8Array(sab);
ta[0] = 48;
Atomics.sub(ta, 0, 12); // ì´ì ê° 48ì ë°íí©ëë¤.
Atomics.load(ta, 0); // 36
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4