| Fixed-Point Toolbox™ | ![]() |
Bitwise exclusive OR of consecutive range of bits
c = bitxorreduce(a)
c = bitxorreduce(a, lidx)
c = bitxorreduce(a, lidx, ridx)
c = bitxorreduce(a) performs a bitwise exclusive OR operation on the entire set of bits in the fi object a and returns the result as a u1,0 (unsigned integer of word length 1).
c = bitxorreduce(a, lidx) performs a bitwise exclusive OR operation on a consecutive range of bits starting at position lidx and ending at the LSB (the bit at position 1). lidx is a constant that represents the position in the range closest to the MSB.
c = bitxorreduce(a, lidx, ridx) performs a bitwise exclusive OR operation on a consecutive range of bits starting at position lidx and ending at position ridx. ridx is a constant that represents the position in the range closest to the LSB.
The bitxorreduce arguments must satisfy the following condition:
a.WordLength >= lidx >= ridx >= 1
a can be a scalar fi object or a vector fi object.
bitxorreduce only supports fi objects with fixed-point data types; it does not support inputs with complex data types.
bitorreduce supports both signed and unsigned inputs with arbitrary scaling. The sign and scaling properties do not affect the result type and value. bitxorreduce performs the operation on a two's complement bit representation of the stored integer.
This example shows how to perform a bitwise exclusive OR operation on a range of bits of a fi object. Consider the following unsigned fixed-point fi object with a value 5, word length 4, and fraction length 0:
0101
Get the bitwise exclusive OR of the consecutive set of bits starting at position 4 and ending at position 2:
1
bitandreduce, bitconcat, bitorreduce, bitsliceget
![]() | bitxor | buffer | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |