This is a translation of the original English documentation page. Help us make it better.

2 Bitwise functions

ここにリストされているすべての機能は、次でサポートされています。

関数パラメーターに関する一般的な注意事項:

  • 関数パラメータはコンマで区切られます
  • 式はパラメーターとして受け入れられます
  • オプションの関数パラメーター (またはパラメーター部分) は < > で示されます
関数
説明 関数固有のパラメーター コメント
bitand (value,mask)
項目値とマスクの"ビット論理積"の値 value - チェックする値
mask (必須) - 64 ビットの符号なし整数 (0 - 18446744073709551615)
サポートされている値の型:int

比較はビットごとにすべての値を指定する必要があり、10 進数で返されます。 たとえば3 番目のビットのチェックは、100 ではなく 4 と比較して行われます。

例:
=> bitand(last(/host/key),12 )=8 または bitand(last(/host/key),12)=4 → 3 番目または 4 番目のビットが設定されますが、両方が同時に設定されることはありません
=> bitand (last(/host/key),20)=16 → 3 番目のビットが設定されておらず、5 番目のビットが設定されています。
bitlshift (value,bits to shift)
アイテム値のビット単位左シフト value - チェックする値
bits to shift (必須) - シフトするビット数
サポートされている値の型: int

比較はビットごとに行われますが、すべての値を指定する必要があり、10 進数で返されます。 たとえば、3 番目のビットのチェックは、100 ではなく 4 と比較して行われます。
bitnot (value)
項目値の"ビット否定"の値 value - チェックする値
サポートされている値の型: int

比較はビットごとに行われますが、すべての値を指定する必要があり、10 進数で返されます。 たとえば、3 番目のビットのチェックは、100 ではなく 4 と比較して行われます。
bitor (value,mask)
項目値とマスクの"ビット論理和"の値 value - チェックする値
mask (必須) - 64 ビットの符号なし整数 (0 - 18446744073709551615)
サポートされている値の型: int

比較はビットごとに行われますが、すべての値を指定する必要があり、10 進数で返されます。 たとえば、3 番目のビットのチェックは、100 ではなく 4 と比較して行われます。
bitrshift (value,bits to shift)
アイテム値のビット単位右シフト value - チェックする値
bits to shift (必須) - シフトするビット数
サポートされている値の型: int

比較はビットごとに行われますが、すべての値を指定する必要があり、10 進数で返されます。 たとえば、3 番目のビットのチェックは、100 ではなく 4 と比較して行われます。
bitxor (value,mask)
項目値とマスクの"ビット排他的論理和"の値 value - チェックする値
mask (必須) - 64 ビットの符号なし整数 (0 - 18446744073709551615)
サポートされている値の型: int

比較はビットごとに行われますが、すべての値を指定する必要があり、10 進数で返されます。 たとえば、3 番目のビットのチェックは、100 ではなく 4 と比較して行われます。

Function details

Some general notes on function parameters:

  • Function parameters are separated by a comma
  • Expressions are accepted as parameters
  • Optional function parameters (or parameter parts) are indicated by < >
bitand(value,mask)

The value of "bitwise AND" of an item value and mask.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • mask (mandatory) - a 64-bit unsigned integer (0 - 18446744073709551615).

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

Examples:

bitand(last(/host/key),12)=8 or bitand(last(/host/key),12)=4 #3rd or 4th bit set, but not both at the same time
       bitand(last(/host/key),20)=16 #3rd bit not set and 5th bit set
bitlshift(value,bits to shift)

The bitwise shift left of an item value.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • bits to shift (mandatory) - the number of bits to shift.

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

bitnot(value)

The value of "bitwise NOT" of an item value.
Supported value types: Integer.

Parameter:

  • value - the value to check.

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

bitor(value,mask)

The value of "bitwise OR" of an item value and mask.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • mask (mandatory) - a 64-bit unsigned integer (0 - 18446744073709551615).

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

bitrshift(value,bits to shift)

The bitwise shift right of an item value.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • bits to shift (mandatory) - the number of bits to shift.

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

bitxor(value,mask)

The value of "bitwise exclusive OR" of an item value and mask.
Supported value types: Integer.

Parameter:

  • value - the value to check;
  • mask (mandatory) - a 64-bit unsigned integer (0 - 18446744073709551615).

Although the comparison is done in a bitwise manner, all the values must be supplied and are returned in decimal. For example, checking for the 3rd bit is done by comparing to 4, not 100.

See all supported functions.