AddBitValue
See Also: Miscellaneous Functions, IsFlagIn, RemoveBitValue, IAND operator, IOR operator
Purpose
Returns an integer value bitwise OR'ed with another integer value.
Return Type
Syntax
Use GlobalFunctionsProcedures.pkg
(AddBitValue({iBitValue}, {iSource}))
What It Does
AddBitValue performs a bitwise OR operation on the two parameters {iBitValue} and {iSource}, returning the result as an integer.
The following truth table displays the possible outputs of a binary OR operation between two binary digits:
| Ior | 0 | 1 |
|---|---|---|
| 0 | 0 | 1 |
| 1 | 1 | 1 |
If two integer values are bitwise OR'ed together, the resulting integer value is calculated by performing a binary OR for each binary digit in the integer operands.
For example, 2704 ior 255 = 2815. We can see this by inspecting the binary values of each integer:
2704: 1010 1000 0000
255: 0000 1111 1111
2815: 1010 1111 1111
Examples
Use GlobalFunctionsProcedures.pkg
Procedure Test
Integer iResult
Move (AddBitValue(2704, 255)) to iResult
Send Info_Box("Result = " + String(iResult)) "Test"
End_Procedure
Notes
AddBitValue is useful for binary encoding information into a single integer value.