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

SIMD.shiftLeftByScalar

SIMD.js已经从TC39中取消了积极的开发,并从第三阶段中删除了。它不再被网页浏览器所追求。暴露在 web 上的SIMD 操作在 WebAssembly 中正处于积极的发展之中, 其操作基于 SIMD. js 操作。

静态SIMD.%type%.shiftLeftByScalar()方法返回一个新的实例,将通道值左移一个给定的位数(a << bits)。

语法

代码语言:javascript
复制
SIMD.Int8x16.shiftLeftByScalar(a, bits)
SIMD.Int16x8.shiftLeftByScalar(a, bits)
SIMD.Int32x4.shiftLeftByScalar(a, bits)

SIMD.Uint8x16.shiftLeftByScalar(a, bits)
SIMD.Uint16x8.shiftLeftByScalar(a, bits)
SIMD.Uint32x4.shiftLeftByScalar(a, bits)

参数

a SIMD类型的实例。bits位数转移。

返回值

一个新的相应SIMD数据类型,其中通道值向左偏移一个给定的位数(a << bits)。

描述

按位左移操作将指定的位数向左移动。向左移位的多余位被丢弃。零位从右侧移入。

例如,十进制中的5 << 1结果按位左移1010

代码语言:javascript
复制
5  0101
   ----
10 1010

例子

按位左移 Int32x4

代码语言:javascript
复制
var a = SIMD.Int32x4(1, 2, 4, 8);
SIMD.Int32x4.shiftLeftByScalar(a, 1);
// Int32x4[2, 4, 8, 16]

规范

Specification

Status

Comment

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