这篇翻译不完整。请帮忙从英语翻译这篇文章

SIMD.js has been taken out of active development in TC39 and removed from Stage 3. It is not being pursued by web browsers for implementation anymore. SIMD operations exposed to the web are under active development within WebAssembly, with operations based on the SIMD.js operations.

The SIMD.Bool16x8 data type is a 128-bit vector divided into 8 lanes storing boolean values.

语法

SIMD.Bool16x8(s0, s1, s2, s3, s4, s5, s6, s7);

参数

s[0-7] 可选
可以指定每一个布尔值,也可以不指定. 默认值为false.

构造函数

In addition to the simple creator function, the SIMD API provides the following constructor functions.

SIMD.Bool16x8.splat()
Creates an Bool6x8 with all lanes set to a given value.

Note: SIMD types don't work with new, as SIMD values are no "boxed" objects (comparable to String(s) vs. new String(s), which creates a String object).

var v = new SIMD.Bool16x8(true, true, true, true, false, false, false, false); 
// TypeError: SIMD.Bool16x8 is not a constructor
var w = new SIMD.Bool16x8.splat(true); 
// TypeError: SIMD.Bool16x8.splat is not a constructor

Instead, you just write:

var v = SIMD.Bool16x8(true, true, true, true, false, false, false, false);
var w = SIMD.Bool16x8.splat(true);

Operations 操作

To actually do something with SIMD types, SIMD operations are needed that work on SIMD data types.

Checking SIMD types

SIMD.Bool16x8.check()
Returns a new Bool16x8 if the parameter is a valid Bool16x8 data type. Throws a TypeError otherwise.

Accessing and mutating lanes

SIMD.Bool16x8.extractLane()
Returns the value of the given lane.
SIMD.Bool16x8.replaceLane()
Returns a new Bool16x8 with the given lane value replaced.

Boolean operations

SIMD.Bool16x8.allTrue()
Checks if all lanes hold a true value.
SIMD.Bool16x8.anyTrue()
Checks if any of the lanes hold a true value.

Bitwise logical operations

SIMD.Bool16x8.and()
Returns a new Bool16x8 with the logical AND of the lane values (a & b).
SIMD.Bool16x8.or()
Returns a new Bool16x8 with the logical OR of the lane values (a | b).
SIMD.Bool16x8.xor()
Returns a new Bool16x8 with the logical XOR of the lane values (a ^ b).
SIMD.Bool16x8.not()
Returns a new Bool16x8 with lane with the logical NOT of the lane values (~a).

SIMD prototype

The following methods and properties are installed on the SIMD.Bool16x8.prototype.

SIMD.Bool16x8.prototype.constructor
Specifies the function that creates a SIMD object's prototype.
SIMD.Bool16x8.prototype.toLocaleString()
Returns a localized string representing the SIMD type and its elements. Overrides the Object.prototype.toLocaleString() method.
SIMD.Bool16x8.prototype.toString()
Returns a string representing the SIMD type and its elements. Overrides the Object.prototype.toString() method.
SIMD.Bool16x8.prototype.valueOf()
Returns the primitive value of a SIMD object.
SIMD.Bool16x8.prototype.toSource()
Returns a string representing the source code of the object. Overrides the Object.prototype.toSource() method.

Examples

Constructing a Bool16x8

SIMD.Bool16x8(true, true, true, true, false, false, false, false); 
// Bool16x8[true, true, true, true, false, false, false, false]

SIMD.Bool16x8(true, false);
// Bool16x8[true, false, false, false, false, false, false, false]

SIMD.Bool16x8();
// Bool16x8[false, false, false false, false, false, false, false]

Specifications

Specification Status Comment
SIMD
Bool16x8
Obsolete Initial definition.

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 未实现 Nightly build Nightly build 未实现 未实现 未实现
Feature Android Chrome for Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 未实现 未实现 Nightly build Nightly build 未实现 未实现 未实现

See also

文档标签和贡献者

 此页面的贡献者: BUnnY25
 最后编辑者: BUnnY25,