IntBitOr (NoSQL query)

APPLIES TO: NoSQL

Compares the bits on both the left-hand and right-hand operators using inclusive OR and returns a result for each bit. If either bit is 1, the corresponding bit is 1. Otherwise, the corresponding bit is 0. For more information, see bitwise inclusive OR operator.

Syntax

IntBitOr(<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 {
    inclusiveOr: IntBitOr(56, 100),
    inclusiveOrSame: IntBitOr(56, 56),
    inclusiveOrZero: IntBitOr(56, 0),
    inclusiveOrDecimal: IntBitOr(56, 0.1)
}
[
  {
    "inclusiveOr": 124,
    "inclusiveOrSame": 56,
    "inclusiveOrZero": 56
  }
]

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