SIMD.and
静态SIMD.%type%.and()
方法返回一个新的实例,其中道值(a & b
)的逻辑与。此操作仅在整型和布尔型SIMD类型上存在。
语法
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类型的实例。b
SIMD类型的另一个实例。
返回值
一个新的相应的SIMD数据类型,其逻辑与通道值(a & b
)相同。
描述
按位与运算仅产生1,如果两个a
和b
是1.真值表与操作是:
a | b | a & b |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
例如,一个按位与AND的5 & 1
结果0001
是十进制的1。
5 0101
1 0001
----
1 0001
例子
两个 Int32x4
的按位与
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 |
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com