Baseline Widely available
Atomics.or()
ì ì ë©ìëë ë°°ì´ìì 주ì´ì§ ìì¹ì 주ì´ì§ ê°ì¼ë¡ OR ë¹í¸ ì°ì°ì ìííê³ í´ë¹ í¬ì§ì
ì 기존 ê°ì ë°íí©ëë¤. ì´ ìí 믹 ì°ì°ì ìì ë ê°ì´ ì°ì´ê¸° ì ê¹ì§ ë¤ë¥¸ ì°ê¸° ì°ì°ì´ ì¼ì´ëì§ ììì ë³´ì¥í©ëë¤.
// Create a SharedArrayBuffer with a size in bytes
const buffer = new SharedArrayBuffer(16);
const uint8 = new Uint8Array(buffer);
uint8[0] = 5;
// 5 (0101) OR 2 (0010) = 7 (0111)
console.log(Atomics.or(uint8, 0, 2));
// Expected output: 5
console.log(Atomics.load(uint8, 0));
// Expected output: 7
구문
Atomics.or(typedArray, index, value)
매ê°ë³ì
typedArray
ì ìí íìí ë°°ì´. Int8Array
, Uint8Array
, Int16Array
, Uint16Array
, Int32Array
, Uint32Array
, BigInt64Array
, BigUint64Array
ì¤ íë.
index
ë¹í¸ ì°ì° OR를 ê³ì°í typedArray
ì ì¸ë±ì¤ì
ëë¤.
value
ë¹í¸ ì°ì° ORì ê°ì´ ê³ì°í ì«ìì ëë¤.
주ì´ì§ ìì¹(typedArray[index]
)ì ìì ê°.
typedArray
ê° íì©ë ì ìíì´ ìë ê²½ì° TypeError
ê° ë°ìí©ëë¤.index
ê° typedArray
ì ë²ì를 ë²ì´ë ê²½ì° RangeError
ê° ë°ìí©ëë¤.ë¹í¸ ì°ì° ORì a
ì b
ì¤ íëë¼ë 1ì´ë©´ 1ì ì°ì¶í©ëë¤. OR ì°ì°ì ëí ì§ë¦¬íë ë¤ìê³¼ ê°ìµëë¤.
a
b
a | b
0 0 0 0 1 1 1 0 1 1 1 1
ì를 ë¤ì´, 5 | 1
ì ë¹í¸ ì°ì° ORì ê°ì 0101
ì´ë©° 10ì§ìë¡ 5ì
ëë¤.
5 0101 1 0001 ---- 5 0101ìì or ì¬ì©í기
const sab = new SharedArrayBuffer(1024);
const ta = new Uint8Array(sab);
ta[0] = 2;
Atomics.or(ta, 0, 1); // ì´ì ê° 2를 ë°íí©ëë¤.
Atomics.load(ta, 0); // 3
ëª
ì¸ì ë¸ë¼ì°ì í¸íì± ê°ì´ 보기
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