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.Uint16x8
data type is a 128-bit vector divided into 8 lanes storing 16-bit unsigned integer values.
SIMD.Uint16x8(s0, s1, s2, s3, s4, s5, s6, s7);
s[0-7]
Optional
In addition to the simple creator function, the SIMD API provides the following constructor functions.
SIMD.Uint16x8.splat()
You can also convert from another SIMD data type to Uint16x8.
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.Uint16x8(1, 2, 3, 4, 5, 6, 7, 8); // TypeError: SIMD.Uint16x8 is not a constructor var w = new SIMD.Uint16x8.splat(3); // TypeError: SIMD.Uint16x8.splat is not a constructor
Instead, you just write:
var v = SIMD.Uint16x8(1, 2, 3, 4, 5, 6, 7, 8); var w = SIMD.Uint16x8.splat(3);
To actually do something with SIMD types, SIMD operations are needed that work on SIMD data types.
SIMD.Uint16x8.check()
TypeError
otherwise.SIMD.Uint16x8.extractLane()
SIMD.Uint16x8.replaceLane()
SIMD.Uint16x8.load()
SIMD.Uint16x8.store()
SIMD.Uint16x8.add()
a + b
).SIMD.Uint16x8.addSaturate()
a + b
) and saturating behavior on overflow.SIMD.Uint16x8.mul()
a * b
).SIMD.Uint16x8.neg()
SIMD.Uint16x8.sub()
a - b
).SIMD.Uint16x8.subSaturate()
a - b
) and saturating behavior on overflow.SIMD.Uint16x8.shuffle()
SIMD.Uint16x8.swizzle()
SIMD.Uint16x8.select()
SIMD.Uint16x8.equal()
a == b
.SIMD.Uint16x8.notEqual()
a != b
.SIMD.Uint16x8.lessThan()
a < b
.SIMD.Uint16x8.lessThanOrEqual()
a <= b
.SIMD.Uint16x8.greaterThan()
a > b
.SIMD.Uint16x8.greaterThanOrEqual()
a >= b
.SIMD.Uint16x8.and()
a & b
).SIMD.Uint16x8.or()
a | b
).SIMD.Uint16x8.xor()
a ^ b
).SIMD.Uint16x8.not()
~a
).SIMD.Uint16x8.shiftLeftByScalar()
a << bits
).SIMD.Uint16x8.shiftRightByScalar()
SIMD.Uint16x8.fromFloat32x4Bits()
SIMD.Uint16x8.fromFloat64x2Bits()
SIMD.Uint16x8.fromInt32x4Bits()
SIMD.Uint16x8.fromInt16x8Bits()
SIMD.Uint16x8.fromInt8x16Bits()
SIMD.Uint16x8.fromUint32x4Bits()
SIMD.Uint16x8.fromUint8x16Bits()
The following methods and properties are installed on the SIMD.Uint16x8.prototype
.
SIMD.Uint16x8.prototype.constructor
SIMD.Uint16x8.prototype.toLocaleString()
Object.prototype.toLocaleString()
method.SIMD.Uint16x8.prototype.toString()
Object.prototype.toString()
method.SIMD.Uint16x8.prototype.valueOf()
SIMD.Uint16x8.prototype.toSource()
Object.prototype.toSource()
method.SIMD.Uint16x8(1, 2, 3, 4, 5, 6, 7, 8); // Int16x8[1, 2, 3, 4, 5, 6, 7, 8] SIMD.Uint16x8(1, 2); // Int16x8[1, 2, 0, 0, 0, 0, 0, 0] SIMD.Uint16x8(); // Int16x8[0, 0, 0, 0, 0, 0, 0, 0]
Specification | Status | Comment |
---|---|---|
SIMD The definition of 'Uint16x8' 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/Uint16x8