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