Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

SIMD.%type%.check()

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译!

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

Browser compatibility

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

See also

文档标签和贡献者

 此页面的贡献者: fscholz
 最后编辑者: fscholz,