We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

SIMD.%type%.check()

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 static SIMD.%type%.check() method returns a SIMD data type if the parameter is a valid SIMD data type and the same as %type%. Otherwise, a TypeError is thrown.

Syntax

SIMD.Float32x4.check(value)
SIMD.Float64x2.check(value)

SIMD.Int8x16.check(value)
SIMD.Int16x8.check(value)
SIMD.Int32x4.check(value)

SIMD.Uint8x16.check(value)
SIMD.Uint16x8.check(value)
SIMD.Uint32x4.check(value)

SIMD.Bool8x16.check(value) 
SIMD.Bool16x8.check(value) 
SIMD.Bool32x4.check(value)
SIMD.Bool64x2.check(value)

Parameters

value
The value to check whether it is a corresponding SIMD data type.

Return value

The corresponding SIMD data type, if valid.

Exceptions

A TypeError, if the argument is not a valid SIMD data type or does not correspond to %type%.

Examples

Checking if a SIMD data type is valid

var a = SIMD.Float32x4(1, 2, 3, 9);

SIMD.Float32x4.check(a);
// Float32x4[1, 2, 3, 9]

SIMD.Float32x4.check([1,2,3,4]);
// TypeError

SIMD.Int32x4.check(a);
// TypeError as a is a Float32x4 not an Int32x4

SIMD.Int32x4.check({});
// TypeError
SIMD.Int32x4.check('Hi Vector-Viktor!');
// TypeError

Specifications

Specification Status Comment
SIMD
The definition of 'SIMDConstructor.check' in that specification.
Obsolete Initial definition.

Browser compatibility

Experimental SIMD.js has been removed from browsers. It's still available in Firefox Nightly, but will be removed in favor of a SIMD implementation in WebAssembly. See also bug 1416723.

See also

Document Tags and Contributors

Contributors to this page: fscholz, nmve
Last updated by: fscholz,