| Contents | Index |
c = bitandreduce(a)
c = bitandreduce(a, lidx)
c = bitandreduce(a, lidx, ridx)
c = bitandreduce(a) performs a bitwise AND 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 = bitandreduce(a, lidx) performs a bitwise AND 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 = bitandreduce(a, lidx, ridx) performs a bitwise AND 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 bitandreduce arguments must satisfy the following condition:
a.WordLength >= lidx >= ridx >= 1
a can be a scalar fi object or a vector fi object.
bitandreduce only supports fi objects with fixed-point data types; it does not support inputs with complex data types.
bitandreduce supports both signed and unsigned inputs with arbitrary scaling. The sign and scaling properties do not affect the result type and value. bitandreduce performs the operation on a two's complement bit representation of the stored integer.
This example shows how to perform a bitwise AND 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:
a = fi(5,0,4,0); disp(bin(a)) 0101
Get the bitwise AND of the consecutive set of bits starting at position 2 and ending at position 1:
disp(bin(bitandreduce(a,2,1))) 0
bitconcat | bitorreduce | bitsliceget | bitxorreduce

Learn how to apply early verification to your development process through these technical resources.
How much time do you spend on testing to ensure implementation meets system-level requirements?
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |