IntBitRightShift (NoSQL query)

APPLIES TO: NoSQL

Shifts the left-hand operator right by the number of bits defined by its right-hand operand. For more information, see right shifts.

Syntax

IntBitRightShift(<int_expr_1>, <int_expr_2>)

Arguments

Description
int_expr_1 An integer expression, which is used as the left-hand operand.
int_expr_2 An integer expression, which is used as the right-hand operand.

Return types

Returns a 64-bit integer.

Note

For more information, see __int64.

Examples

This example tests the function with various static values.

SELECT VALUE {
    shiftInteger: IntBitRightShift(16, 4),
    shiftDecimal: IntBitRightShift(16, 0.4)
}
[
  {
    "shiftInteger": 1
  }
]

Remarks

  • This function expects integers for both arguments and performs operations assuming the values are a 64-bit integer.
  • If any of the arguments aren't an integer, the function returns undefined.
  • Overflow behavior is similar to the implementation in C++ (wrap-around).

See also