Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2021年12月.
Atomics.xor() は静的メソッドで、配列内の指定した位置にある指定された値とのビット単位の XOR を計算し、その位置にあった古い値を返します。これは不可分操作であり、変更された値が書き戻されるまで他の書き込みが行われないことが保証されます。
整数の型付き配列です。 Int8Array、Uint8Array、Int16Array、Uint16Array、Int32Array、Uint32Array、BigInt64Array、BigUint64Array のいずれかです。
indextypedArray の中でビット単位の XOR を計算する位置です。
valueビット単位の XOR を計算する値です。
指定された位置にあった古い値 (typedArray[index]) です。
typedArray が許可された整数型のいずれでもない場合に発生します。
RangeErrorindex が typedArray の範囲を超えている場合に発生します。
ビット単位の XOR 演算は、 a と b が異なる場合に 1 になります。 XOR 演算の真理値表は次の通りです。
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
例えば、ビット単位の XOR では 5 ^ 1 の結果が 0100、すなわち 10 進数で 4 になります。
5 0101 1 0001 ---- 4 0100| ECMAScript® 2027 Language Specification # sec-atomics.xor |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年7月25日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.