ערוך

שתף באמצעות


IntBitAnd (NoSQL query)

APPLIES TO: NoSQL

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

Syntax

IntBitAnd(<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 {
    compareNumbers: IntBitAnd(15, 25),
    compareZero: IntBitAnd(15, 0),
    compareSameNumber: IntBitAnd(15, 15),
    compareDecimal: IntBitAnd(15, 1.5)
}
[
  {
    "compareNumbers": 9,
    "compareZero": 0,
    "compareSameNumber": 15
  }
]

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