bitcmp - Bitwise complement of fi object

Syntax

c = bitcmp(a)

Description

c = bitcmp(a) returns the bitwise complement of fi object a. If a has a signed numerictype, the bit representation of the stored integer is in two's complement representation.

bitcmp only supports fi objects with fixed-point data types. a can be a scalar fi object or a vector fi object.

Example

This example shows how to get the bitwise complement of a fi object. Consider the following unsigned fixed-point fi object with a value of 10, word length 4, and fraction length 0:

a = fi(10,0,4,0);
disp(bin(a))

1010

Complement the values of the bits in a:

c = bitcmp(a);
disp(bin(c))

0101

See Also

bitand, bitget, bitor, bitset, bitxor

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS