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/left_shift/index.html | 75 ---------------------- 1 file changed, 75 deletions(-) delete mode 100644 files/ja/web/javascript/reference/operators/left_shift/index.html (limited to 'files/ja/web/javascript/reference/operators/left_shift/index.html') diff --git a/files/ja/web/javascript/reference/operators/left_shift/index.html b/files/ja/web/javascript/reference/operators/left_shift/index.html deleted file mode 100644 index e0f494ba5a..0000000000 --- a/files/ja/web/javascript/reference/operators/left_shift/index.html +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: 左シフト (<<) -slug: Web/JavaScript/Reference/Operators/Left_shift -tags: - - Bitwise operator - - JavaScript - - Language feature - - Operator - - Reference - - ビット演算子 - - 演算子 - - 言語機能 -translation_of: Web/JavaScript/Reference/Operators/Left_shift ---- -
{{jsSidebar("Operators")}}
- -

左シフト演算子 (<<)は、1つ目のオペランドを指定されたビット数だけ左にずらします。左にずらしてあふれたビットは廃棄されます。0のビットが右からずれて入ります。

- -
{{EmbedInteractiveExample("pages/js/expressions-left-shift.html")}}
- - - -

構文

- -
a << b
-
- -

解説

- -

この演算子は、1つ目のオペランドを指定されたビット数だけ左にずらします。左にずらしてあふれたビットは廃棄されます。0のビットが右からずれて入ります。

- -

例えば 9 << 2 は 36 になります。

- -
.    9 (10進数): 00000000000000000000000000001001 (2進数)
-                  --------------------------------
-9 << 2 (10進数): 00000000000000000000000000100100 (2進数) = 36 (10進数)
-
- -

任意の数 xy ビット分だけ左にビット単位にずらすと、 x * 2 ** y になります。
- ですから、例えば 9 << 39 * (2 ** 3) = 9 * (8) = 72 になります。

- -

- -

左シフトの使用

- -
9 << 3; // 72
-
-// 9 * (2 ** 3) = 9 * (8) = 72
-
- -

仕様書

- - - - - - - - - - - - -
仕様書
{{SpecName('ESDraft', '#sec-bitwise-shift-operators', 'Bitwise Shift Operators')}}
- -

ブラウザーの互換性

- -

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

- -

関連情報

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