首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

SIMD.add

SIMD.js已经从TC39中取消了积极的开发,并从第三阶段中删除了。它不再被网页浏览器所追求。SIMAs操作正在WebAssembly中进行积极的开发,它应用于Web并且基于SIMD.js操作。

静态SIMD.%type%.add()方法返回一个新的实例,添加了lane值(a + b)。

语法

代码语言:javascript
复制
SIMD.Float32x4.add(a, b)
SIMD.Float64x2.add(a, b)

SIMD.Int8x16.add(a, b)
SIMD.Int16x8.add(a, b)
SIMD.Int32x4.add(a, b)

SIMD.Uint8x16.add(a, b) 
SIMD.Uint16x8.add(a, b) 
SIMD.Uint32x4.add(a, b)

参数

a SIMD类型的实例。

bSIMD类型的另一个实例。

返回值

一个新的相应的SIMD数据类型,通道值为ab添加(a + b)。

例子

代码语言:javascript
复制
var a = SIMD.Float32x4(-1, -2, 3, 4);
var b = SIMD.Float32x4(3, 3, 3, 3);
SIMD.Float32x4.add(a, b);
// Float32x4[2, 1, 6, 7]

var c = SIMD.Int16x8(1, 1, 1, 1, 1, 1, 1, 1);
var d = SIMD.Int16x8(3, 3, 3, 3, 3, 3, 3, 3);
SIMD.Int16x8.add(c, d)
// Int16x8[4, 4, 4, 4, 4, 4, 4, 4]

规范

Specification

Status

Comment

SIMDThe definition of 'SIMDConstructor.add' 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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com