IFX_BIT_LEFTSHIFT Function

The IFX_BIT_LEFTSHIFT function performs a bit left shift operation on an integer or bigint value and returns the shift result

The IFX_BIT_LEFTSHIFT function performs a bit left shift operation on an integer or bigint value and returns the shift result. It takes as arguments an integer or bigint operand and an integer operator. The type of the operand will be the function's return type. The operator determines the number of bits by which the passed in value gets shifted to the left, its value should range between 0 and 31 for integer operands, and between 0 and 63 for bigint operands (any other values might be taken as their modulo of 32 or 64 respectively, but that's not guaranteed).

The effect of ifx_bit_leftshift is equivalent to multiplying the operand by 2 to the power of operator, but is of course limited to the resulting type's capacity.

With both integer and bigint, the value with only the high bit set carries special meaning as it signifies a NULL value. Should the bit shift result in an integer 0x80000000, you'd receive error 1215, whereas a bigint result 0x8000000000000000 would be returned as NULL.
Examples:

           operand    operator      result
                 1           4          16  (0x00000010)
                 3           2          12  (0x0000000c)
  "0x800"::integer           5       65536  (0x00010000)
             12345          26  -469762048  (0xe4000000)
                 1          31  error 1215
         1::bigint          31  2147483648  (0x80000000)