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

SIMD.and

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

静态SIMD.%type%.and()方法返回一个新的实例,其中道值(a & b)的逻辑与。此操作仅在整型和布尔型SIMD类型上存在。

语法

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

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

SIMD.Bool8x16.and(a, b) 
SIMD.Bool16x8.and(a, b) 
SIMD.Bool32x4.and(a, b)
SIMD.Bool64x2.and(a, b)

参数

a SIMD类型的实例。bSIMD类型的另一个实例。

返回值

一个新的相应的SIMD数据类型,其逻辑与通道值(a & b)相同。

描述

按位与运算仅产生1,如果两个ab是1.真值表与操作是:

a

b

a & b

0

0

0

0

1

0

1

0

0

1

1

1

例如,一个按位与AND的5 & 1结果0001是十进制的1。

代码语言:javascript
复制
5  0101
1  0001
   ----
1  0001

例子

两个 Int32x4的按位与

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

规范

Specification

Status

Comment

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