<< bitset bitwise Complex >>

Scilab help >> Elementary Functions > bitwise > bitxor

bitxor

ビット単位の排他的論理和(XOR)

呼び出し手順

z = bitxor(x,y)

パラメータ

x :

m行n列の行列(double)またはm1 x m2 x ... x mm ハイパー行列(double) または符合なし整数(uint8, uint16 または uint32)の m行n列行列.値は正の整数値である必要があります.

y :

m行n列の行列(double)またはm1 x m2 x ... x mm ハイパー行列(double) または符合なし整数(uint8, uint16 または uint32)の m行n列行列.値は正の整数値である必要があります.

z :

m行n列の行列(double)またはm1 x m2 x ... x mm ハイパー行列(double) または符合なし整数.

説明

2つの正の整数 x および y を指定すると,この関数は2進形式が x および y の2進形式の排他的論理和となるような10進数を返します.

例

// Compute the bitwise XOR of two matrices of doubles.
x = [0 1 0 1];
y = [0 0 1 1];
z = bitxor(x, y)
expected = [0 1 1 1];

// Compute the bitwise XOR of two matrices of integers.
x = uint8([0 1 0 1]);
y = uint8([0 0 1 1]);
z = bitxor(x, y)

// The types of x and y cannot be mixed (error).
x = [0 1 0 1];
y = uint8([0 0 1 1]);
z = bitxor(x, y)

//  13 is (01101)_2
//  27 is (11011)_2
// XOR is (10110)_2 which is 22.
bitxor(uint8(13), uint8(27))
bitxor(13, 27)

作者

<< bitset bitwise Complex >>