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.Bool64x2

Nuestros voluntarios aún no han traducido este artículo al Español. Únete a nosotros y ayúdanos a traducirlo

Note: The Bool64x2 type is currently not part of the SIMD specification draft.

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

Syntax

SIMD.Bool64x2(x, y);

Parameters

x Optional
A boolean specifying the value of the first lane. Defaults to false.
y Optional
An boolean specifying the value of the second lane. Defaults to false.

Constructor functions

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

SIMD.Bool64x2.splat()
Creates a Bool64x2 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.Bool64x2(true,false); 
// TypeError: SIMD.Bool64x2 is not a constructor
var w = new SIMD.Bool64x2.splat(true); 
// TypeError: SIMD.Bool64x2.splat is not a constructor

Instead, you just write:

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

Operations

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

Checking SIMD types

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

Accessing and mutating lanes

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

Boolean operations

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

Bitwise logical operations

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

SIMD prototype

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

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

Examples

Constructing a Bool64x2

SIMD.Bool64x2(true, false); // Bool64x2[true, false]
SIMD.Bool64x2(1);           // Bool64x2[true, false]
SIMD.Bool64x2();            // Bool64x2[false, false]

Specifications

The Bool64x2 type is currently not part of the SIMD specification draft.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support No support Nightly build No support No support No support
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support No support No support Nightly build No support No support No support

See also

Etiquetas y colaboradores del documento

 Colaboradores en esta página: fscholz
 Última actualización por: fscholz,