Main Content

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.

Examples

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

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.

Version History

Introduced before R2006a

See Also

| | | |