Bitwise exclusive `OR`

of two `fi`

objects

* c* = bitxor(

`a`

`b`

returns
the bitwise exclusive * c* = bitxor(

`a`

`b`

`OR`

of `fi`

objects `a`

`b`

Elements in the output array

are assigned a value of`c`

`1`

when exactly one of the corresponding bits in the input arrays has a value of`1`

.Elements in the output array

are assigned a value of`c`

`0`

when the corresponding bits in the input arrays have the same value (e.g. both`1`

's or both`0`

's).

The `numerictype`

properties associated with * a* and

`b`

`numerictype`

is
signed, then the bit representation of the stored integer is in two's
complement representation.* a* and

`b`

`bitxor`

only supports `fi`

objects
with fixed-point data types.

The following example finds the bitwise exclusive `OR`

of `fi`

objects *a* and *b*.

a = fi(-28,1,6,0); b = fi(12, 1, 6, 0); c = bitxor(a,b) c = -24 DataTypeMode: Fixed-point: binary point scaling Signedness: Signed WordLength: 6 FractionLength: 0

You can verify the result by examining the binary representations
of *a*, *b* and *c*.

binary_a = a.bin binary_b = b.bin binary_c = c.bin binary_a = 100100 binary_b = 001100 binary_c = 101000

Was this topic helpful?