From c3fdf27c2d7a26303ceffd2ee9394a4fc3195dce Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Fri, 10 Dec 2021 00:17:01 +0900 Subject: Global_Objects/Atomics 以下の変換準備 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global_objects/atomics/and/index.html | 129 --------------------- 1 file changed, 129 deletions(-) delete mode 100644 files/ja/web/javascript/reference/global_objects/atomics/and/index.html (limited to 'files/ja/web/javascript/reference/global_objects/atomics/and/index.html') diff --git a/files/ja/web/javascript/reference/global_objects/atomics/and/index.html b/files/ja/web/javascript/reference/global_objects/atomics/and/index.html deleted file mode 100644 index c03d40648b..0000000000 --- a/files/ja/web/javascript/reference/global_objects/atomics/and/index.html +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: Atomics.and() -slug: Web/JavaScript/Reference/Global_Objects/Atomics/and -tags: - - Atomics - - JavaScript - - Method - - Shared Memory - - メソッド - - 共有メモリ -translation_of: Web/JavaScript/Reference/Global_Objects/Atomics/and ---- -
{{JSRef}}
- -

静的な Atomics.and() メソッドは、配列内の指定した位置の値に指定した値でビット単位の AND を計算し、その位置の古い値を返します。これは不可分操作で、修正された値が書き戻されるまで、他の書き込みが起こらないことを保証します。

- -
{{EmbedInteractiveExample("pages/js/atomics-and.html")}}
- - - -

構文

- -
Atomics.and(typedArray, index, value)
-
- -

引数

- -
-
typedArray
-
共有整数型付き配列です。 {{jsxref("Int8Array")}}, {{jsxref("Uint8Array")}}, {{jsxref("Int16Array")}}, {{jsxref("Uint16Array")}}, {{jsxref("Int32Array")}}, {{jsxref("Uint32Array")}} の何れかです。
-
index
-
typedArray でビット単位の AND を計s名する位置です。
-
value
-
ビット単位の AND を取る数値です。
-
- -

返値

- -

指定された位置にあった古い値です (typedArray[index])。

- -

例外

- - - -

解説

- -

ビット単位の AND 操作は、 ab の両方が 1 であった場合のみ 1 を生成します。 AND 操作の真理値表を示します。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
aba & b
000
010
100
111
- -

例えば、ビット単位の AND を 5 & 1 で行うと、結果は 0001 すなわち10進数で1となります。

- -
5  0101
-1  0001
-   ----
-1  0001
- -

- -

add() の使用

- -
const sab = new SharedArrayBuffer(1024);
-const ta = new Uint8Array(sab);
-ta[0] = 5;
-
-Atomics.and(ta, 0, 1); // returns 0, the old value
-Atomics.load(ta, 0);  // 1
-
- -

仕様書

- - - - - - - - - - - - -
仕様書
{{SpecName('ESDraft', '#sec-atomics.and', 'Atomics.and')}}
- -

ブラウザーの互換性

- -

{{Compat("javascript.builtins.Atomics.and")}}

- -

関連情報

- - -- cgit v1.2.3-54-g00ecf