Please note that the recommended version of Scilab is 2026.0.0. This page might be outdated.
See the recommended documentation of this function
bitcmp
bitwise complement
Calling Sequence
y = bitcmp(x) y = bitcmp(x, bitnum)
Parameters
- x :
a
m-by-nmatrix of doubles or am1-by-m2-by-...-by-mmhypermatrix of doubles or am-by-nmatrix of unsigned integers (uint8,uint16oruint32). Must contain positive integer values.- bitnum :
a
m-by-nmatrix of doubles or am1-by-m2-by-...-by-mmhypermatrix of doubles or am-by-nmatrix of unsigned integers (uint8,uint16oruint32). The inputnmust be in the range 1, 2, ...,bitmaxwherebitmaxis the maximum number of bits inx.bitnummust contain positive integer values. The default value forbitnumisbitmax.- y :
a
m-by-nmatrix of doubles or am1-by-m2-by-...-by-mmhypermatrix of doubles or am-by-nmatrix of unsigned integers.
Description
Given an unsigned integer x, this function returns the unsigned integer y
which is the integer corresponding to the complementary of the binary
form of x.
The integer bitnum sets the maximum number of bits.
If the bits number of the x binary representation is less than the
bitmax number (8,16 or 32) then the bits '1' are added to the
complementary in order to have bitmax number (8, 16 or 32) for the
complementary.
If only one input argument is given, x must be a matrix of unsigned integers.
Examples
// 13 is (1101)_2 // We insert zeros in the beginning to get a 8-bit number: // (00001101)_2 // The 8-bits complement is then (11110010)_2 // which is 242 bitcmp(13,8) expected = 242 // The input argument can be an unsigned int bitcmp(uint8(99),8) expected = 156
| Report an issue | ||
| << bitand | Bitwise operations | bitget >> |