This article provides a detailed explanation of the bit inversion, position, bit OR, bit OR of easy language operation commands.
Yi Language Version 3.5 provides 4-bit operation commands.
1. Inverse bit
After the bit inversion command converts the specified value into binary, the value of each bit is inverted, that is, 0 becomes 1, 1 becomes 0, and then converted into a decimal number. The return value is the converted decimal number.
The command format of the "Bit Inverse" command is:
〈Integer〉 Inverse bits (the value to be inverse)
The type of parameter "Number to be inverted" is "Integer".
2.
The bits and command convert all the given values into binary and perform the "Ah" operation on the common bits of all binary values. That is, if the common bits of two or more numeric values are 1, the corresponding bits of the return value are also 1, otherwise it is 0. After the operation is completed, the result is converted into a decimal number, and the return value is the converted decimal number.
for example:
If the fourth bit of one value is 1 and the fourth bit of the other value is 1, the fourth bit of the return value is 1;
If the fourth bit of one value is 0 and the fourth bit of the other value is 1, the fourth bit of the return value is 0;
If the fourth bit of one value is 1 and the fourth bit of the other value is 0, the fourth bit of the return value is 0;
If the fourth bit of one value is 0 and the fourth bit of the other value is 0, the fourth bit of the return value is 0;
The command formats of bits and commands are:
〈Integer Type〉 Bits and (bit operation value one, bit operation value two,…)
The parameters "bit operation value" have all types of "integral type".
This command must have at least two parameters, and the last parameter can be added repeatedly.
3.
The bit or command converts all the given values into binary, performs an "OR" operation on the common bits of all binary values. That is, if the common bits of two or more values are 0, the corresponding bits of the return value are also 0, otherwise it is 1 (it can also be said: if one of the common bits of two or more values is 1, the corresponding bits of the return value are 1, otherwise it is 0). After the operation is completed, the result is converted into a decimal number, and the return value is the converted decimal number.
If the fourth bit of one value is 1 and the fourth bit of the other value is 1, the fourth bit of the return value is 1;
If the fourth bit of one value is 0 and the fourth bit of the other value is 1, then the fourth bit of the return value is 1;
If the fourth bit of one value is 1 and the fourth bit of the other value is 0, the fourth bit of the return value is 1;
If the fourth bit of one value is 0 and the fourth bit of the other value is 0, the fourth bit of the return value is 0;
The command format of the "bit or" command is:
<Integer type> Bit or (bit operation value one, bit operation value two,…)
The parameters "bit operation value" have all types of "integral type".
This command must have at least two parameters, and the last parameter can be added repeatedly.
4. Positional or
The bit exclusive OR command converts all the given values into binary and performs an "exclusive OR" operation on the common bits of all binary values. That is, if the common bits of two or more values are equal (both 0 or both 1), the corresponding bit of the return value is 0, otherwise it is 1. After the operation is completed, the result is converted into a decimal number, and the return value is the converted decimal number.
for example:
If the fourth bit of one value is 0 and the fourth bit of the other value is 1, then the fourth bit of the return value is 1;
If the fourth bit of one value is 1 and the fourth bit of the other value is 0, the fourth bit of the return value is 1;
If the fourth bit of one value is 1 and the fourth bit of the other value is 1, the fourth bit of the return value is 0;
If the fourth bit of one value is 0 and the fourth bit of the other value is 0, the fourth bit of the return value is 0;
The command format of the "exclusive OR" command is:
〈Integer Type〉 Bit Exclusive Or (bit operation value one, bit operation value two,…)
The parameters "bit operation value" have all types of "integral type".
This command must have at least two parameters, and the last parameter can be added repeatedly
The above are the explanations of the four important operation names. Thank you for your support.