From 637c6c8f8e048727dafc20583d30310bb036a0a4 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Tue, 28 Sep 2021 00:29:39 +0900 Subject: ビット演算子のドキュメントの変換準備 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reference/operators/bitwise_and/index.html | 112 --------------------- 1 file changed, 112 deletions(-) delete mode 100644 files/ja/web/javascript/reference/operators/bitwise_and/index.html (limited to 'files/ja/web/javascript/reference/operators/bitwise_and/index.html') diff --git a/files/ja/web/javascript/reference/operators/bitwise_and/index.html b/files/ja/web/javascript/reference/operators/bitwise_and/index.html deleted file mode 100644 index 3d9615a528..0000000000 --- a/files/ja/web/javascript/reference/operators/bitwise_and/index.html +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: ビット論理積 (&) -slug: Web/JavaScript/Reference/Operators/Bitwise_AND -tags: - - Bitwise operator - - JavaScript - - Language feature - - Operator - - Reference - - 演算子 - - 言語機能 -translation_of: Web/JavaScript/Reference/Operators/Bitwise_AND ---- -
{{jsSidebar("Operators")}}
- -

ビット論理積演算子 (&) は、両方のオペランドの対応するビットのいずれもが 1 である位置のビットで 1 を返します。

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

構文

- -
a & b
-
- -

解説

- -

オペランドは32ビットの整数値に変換され、ビット (ゼロまたは1) の並びによって表現されます。32ビットを超える数値は最上位のビットが破棄されます。例えば、次の32ビットを超える整数は32ビット整数に変換されます。

- -
変換前: 11100110111110100000000000000110000000000001
-変換後:             10100000000000000110000000000001
- -

第1オペランドの各ビットは、第2オペランドの対応するビットと組み合わせになります。第1ビット第1ビットへ、第2ビット第2ビットへ、という具合にです。

- -

この演算子は各ビットの組み合わせに適用され、結果はビット単位で構築されます。

- -

AND 演算の真理値表は次のようになります。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
aba AND b
000
010
100
111
- -
.    9 (10進数) = 00000000000000000000000000001001 (2進数)
-    14 (10進数) = 00000000000000000000000000001110 (2進数)
-                   --------------------------------
-14 | 9 (10進数) = 00000000000000000000000000001000 (2進数) = 8 (10進数)
-
- -

任意の x0 のビット論理積は 0 になります。

- -

- -

ビット論理積の使用

- -
// 5: 00000000000000000000000000000101
-// 2: 00000000000000000000000000000010
-5 & 2; // 0
- -

仕様書

- - - - - - - - - - - - -
仕様書
{{SpecName('ESDraft', '#prod-BitwiseANDExpression', 'Bitwise AND expression')}}
- -

ブラウザーの互換性

- -

{{Compat("javascript.operators.bitwise_and")}}

- -

関連情報

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