Download HDevelop User`s Manual
Transcript
Operation Meaning HALCON operator lsh(i1,i2) left shift tuple_lsh rsh(i1,i2) right shift tuple_rsh i1 band i2 bitwise and tuple_band i1 bxor i2 bitwise xor tuple_bxor i1 bor i2 bitwise or tuple_bor bnot i bitwise complement tuple_bnot Table 8.9: Bit operations. negation) can be applied to either integer or real numbers. If at least one operand is of type real, the result will be a real number as well. Examples: Expression 4/3 4/3.0 (4/3) * 2.0 Result 1 1.3333333 2.0 Simple examples can be found in the program arithmetic.dev. 8.5.6 Bit Operations This section describes the operators for bit processing of numbers. The operands have to be integers. The result of lsh(i1,i2) is a bitwise left shift of i1 that is applied i2 times. If there is no overflow this is equivalent to a multiplication by 2i2 . The result of rsh(i1,i2) is a bitwise right shift of i1 that is applied i2 times. For non-negative i1 this is equivalent to a division by 2i2 . For negative i1 the result depends on the used hardware. For lsh and rsh the result is undefined if the second operand has a negative value or the value is larger than 32. More examples can be found in the program bit.dev. 8.5.7 String Operations There are several string operations available to modify, select, and combine strings. Furthermore, some operations allow to convert numbers (real and integer) to strings. $ (string conversion) See also: tuple_string $ converts numbers to strings or modifies strings. The operation has two operands: The first one (left of the $) is the number that has to be converted. The second one (right of the $) specifies the conversion. It is comparable to the format string of the printf() function in the C programming language. This format string consists of the following four parts 181 Language 8.5.6 Bit Operations