Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

SIMD.%type%.or()

この記事は編集レビューを必要としています。ぜひご協力ください

この翻訳は不完全です。英語から この記事を翻訳 してください。

This is an experimental technology, part of the Harmony (ECMAScript 7) proposal.
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future version of browsers as the spec changes.

静的なSIMD.%type%.or() メソッドはレーン値の論理的OR演算値をもつ新しいインスタンスを返します(a | b)。

構文

SIMD.float32x4.or(a, b)
SIMD.int8x16.or(a, b)
SIMD.int16x8.or(a, b)
SIMD.int32x4.or(a, b)

引数

a
SIMD型のインスタンス
b
SIMD型の別のインスタンス

戻り値

レーン値の論理的OR演算値をもつ新しい対応するSIMDデータ型(a | b)。

説明

abのどちらかが1なら、ビット単位のOR演算は1を得ます。OR演算の真理値表は下記の通りであります:

a b a | b
0 0 0
0 1 1
1 0 1
1 1 1

例えば、5 & 1のビット単位のOR演算結果は10進数で5である0101となります。

5  0101
1  0001
   ----
5  0101

2つのint32x4のビット単位のOR演算

var a = SIMD.int32x4(1, 2, 4, 8);
var b = SIMD.int32x4(5, 5, 5, 5);
SIMD.int32x4.or(a, b);
// int32x4[5, 7, 5, 13]

2つのfloat32x4のビット単位のOR演算

2つのfloat32x4のOR演算に対して、最初にSIMD.int32x4.fromFloat32x4Bits()を使用してint32x4型にビット単位に変換します。それから、int32x4型でビット単位のOR演算が実施され、最後に、SIMD.float32x4.fromInt32x4Bits()を使用してfloat32x4が返されます。

var a = SIMD.float32x4(1.5, 2.0, 4.0, 8.0);
var b = SIMD.float32x4(5.0, 5.0, 5.0, 5.0);
SIMD.float32x4.or(a, b);
// float32x4[NaN, 5, 5, 20]

仕様

SIMDはまだ公式規格文書やドラフトでサポートされていません。typed arraysに基づいた標準化作業や互換性実装のために、ecmascript_simd GitHub リポジトリを確かめて下さい。

ブラウザ実装状況

機能 Chrome Firefox (Gecko) Internet Explorer Opera Safari
基本サポート 未サポート Nightly build 未サポート 未サポート 未サポート
機能 Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
基本サポート 未サポート 未サポート Nightly build 未サポート 未サポート 未サポート

関連情報

ドキュメントのタグと貢献者

 このページの貢献者: shide55
 最終更新者: shide55,