★ wanayoo — archive 1999 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SIMD/checkNouvelle recherche | Portail wanayoo

SIMD.%type%.check()

by 1 contributor:

This is an experimental technology, part of the ECMAScript 2016 (ES7) proposal.
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 version of browsers as the spec changes.

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.Bool8x16.check(value) 
SIMD.Bool16x8.check(value) 
SIMD.Bool32x4.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.

Errors thrown

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.
Draft Initial definition.

Browser compatibility

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

See also

Document Tags and Contributors

Contributors to this page: fscholz
Last updated by: fscholz,
Hide Sidebar