BitAnd

Not available in this language yet.
BitAnd( value_1, value_2, ... )
BitAnd( value_1, value_2, ... )
BitAnd( value_1, value_2, ... )
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
BitAnd( value_1, value_2, ... )

Description

The BitAnd function returns the bit to the result if the bit exists in all numbers. The arguments must be numbers, and fractional values are truncated before the operation is applied. The result is the bitwise AND of all the arguments.

Parameters

Argument Type Definition and Requirements

value

List of Numbers

A single value or a list of values to bitwise AND.

Returns

A number which is the bitwise AND of all values.

Examples

The query below executes an array of independent bitwise AND operations and returns the answer in the result array. The result array position matches the position in the execution array.

System.out.println(
    client.query(
        Arr(
            BitAnd(Value(0),Value(0)),
            BitAnd(Value(1),Value(0)),
            BitAnd(Value(1),Value(1)),
            BitAnd(Value(7),Value(3))
        )
    ) .get());
client.query([
  q.BitAnd(0, 0),
  q.BitAnd(1, 0),
  q.BitAnd(1, 1),
  q.BitAnd(7, 3),
])
.then((ret) => console.log(ret))
println(Await.result(
  client.query(
    Arr(
      BitAnd(0, 0),
      BitAnd(1, 0),
      BitAnd(1, 1),
      BitAnd(7, 3)
    )
  ),
  5.seconds
))
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
[0, 0, 1, 3]
[ 0, 0, 1, 3 ]
[0, 0, 1, 3]

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!