This is an experimental technology
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 versions of browsers as the specification changes.
The SIMD.Bool32x4
data type is a 128-bit vector divided into 4 lanes storing boolean values.
SIMD.Bool32x4(x, y, z, w);
x
Optional
false
.y
Optional
false
.z
Optional
false
.w
Optional
false
.In addition to the simple creator function, the SIMD API provides the following constructor functions.
SIMD.Bool32x4.splat()
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.Bool32x4(true, false, true, false); // TypeError: SIMD.Bool32x4 is not a constructor var w = new SIMD.Bool32x4.splat(true); // TypeError: SIMD.Bool32x4.splat is not a constructor
Instead, you just write:
var v = SIMD.Bool32x4(true, false, true, false); var w = SIMD.Bool32x4.splat(true);
To actually do something with SIMD types, SIMD operations are needed that work on SIMD data types.
SIMD.Bool32x4.check()
TypeError
otherwise.SIMD.Bool32x4.extractLane()
SIMD.Bool32x4.replaceLane()
SIMD.Bool32x4.allTrue()
true
value.SIMD.Bool32x4.anyTrue()
true
value.SIMD.Bool32x4.and()
a & b
).SIMD.Bool32x4.or()
a | b
).SIMD.Bool32x4.xor()
a ^ b
).SIMD.Bool32x4.not()
~a
).The following methods and properties are installed on the SIMD.Bool32x4.prototype
.
SIMD.Bool32x4.prototype.constructor
SIMD.Bool32x4.prototype.toLocaleString()
Object.prototype.toLocaleString()
method.SIMD.Bool32x4.prototype.toString()
Object.prototype.toString()
method.SIMD.Bool32x4.prototype.valueOf()
SIMD.Bool32x4.prototype.toSource()
Object.prototype.toSource()
method.SIMD.Bool32x4(true, false, true, false); // Bool32x4[true, false, true, false] SIMD.Bool32x4(true, false); // Bool32x4[true, false, false, false] SIMD.Bool32x4(); // Bool32x4[false, false, false, false]
Specification | Status | Comment |
---|---|---|
SIMD The definition of 'Bool32x4' in that specification. | Draft | Initial definition. |
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 |
© 2005–2017 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Bool32x4