[comment]: # attributes: notoc

[comment]: # (terms:  bitand, bitlshift, bitnot, bitor, bitrshift, bitxor )

[comment]: # ({5317f435-ca911365})
# 2 פונקציות Bitwise

כל הפונקציות המפורטות כאן נתמכות ב:

- [ביטויי טריגר](/manual/config/triggers/expression)
- [פריטים מחושבים](/manual/config/items/itemtypes/calculated)

כמה הערות כלליות על פרמטרי פונקציה:

- פרמטרים של פונקציה מופרדים בפסיק
- ביטויים מתקבלים כפרמטרים
- פרמטרים אופציונליים של פונקציה (או חלקי פרמטר) מסומנים על ידי
     `<` `>`

|FUNCTION|<|<|
|--|--|--|
|**תיאור**|**פרמטרים ספציפיים לפונקציה**|**הערות**|
|**bitand** (ערך,מסכה)|<|<|
|ערך של "AND" של ערך פריט ומסכה.|**ערך** - ערך לבדיקה<br>**מסכה** (חובה) - מספר שלם ללא סימן של 64 סיביות (0 - 18446744073709551615)|סוגי ערכים נתמכים : int<br><br>למרות שההשוואה נעשית בצורה סיבית, יש לספק את כל הערכים ומוחזרים בעשרוניות. לדוגמה, בדיקת הסיבית השלישית מתבצעת על ידי השוואה ל-4, לא ל-100.<br><br>דוגמאות:<br>=> **bitand**(last(/host/key),**12** )=8 או **bitand**(last(/host/key),**12**)=4 → 3rd או 4th bit set, אבל לא שניהם בו-זמנית<br>=> **bitand** (last(/host/key),**20**)=16 → ביט שלישי לא מוגדר והביט חמישי מוגדר.|
|**bitlshift** (ערך,bits to shift)|<|<|
|הזזה סיביות שמאלה של ערך פריט.|**ערך** - ערך לבדיקה<br>**bits to shift** (חובה) - מספר סיביות להזזה|סוגי ערכים נתמכים: int<br><br> למרות שההשוואה נעשית בצורה סיבית, יש לספק את כל הערכים ומוחזרים בעשרוניות. לדוגמה, בדיקת הסיביות ה-3 מתבצעת על ידי השוואה ל-4, לא ל-100.|
|**bitnot** (ערך)|<|<|
|ערך של "bitwise NOT" של ערך פריט.|**value** - ערך לבדיקה<br>|סוגי ערכים נתמכים: int<br><br>למרות שההשוואה נעשית בצורה סיבית, כל הערכים יש לספק ומוחזרים בעשרוניות. לדוגמה, בדיקת הסיביות ה-3 מתבצעת על ידי השוואה ל-4, לא ל-100.|
|**bitor** (ערך,מסכה)|<|<|
|ערך של "באופן סיביות" של ערך ומסכה של פריט.|**ערך** - ערך לבדיקה<br>**מסכה** (חובה) - מספר שלם ללא סימן של 64 סיביות (0 - 18446744073709551615)|סוגי ערכים נתמכים : int<br><br>למרות שההשוואה נעשית בצורה סיבית, יש לספק את כל הערכים ומוחזרים בעשרוניות. לדוגמה, בדיקת הסיביות ה-3 מתבצעת על ידי השוואה ל-4, לא ל-100.|
|**bitrshift** (ערך,bits to shift)|<|<|
|הזזה ימינה של ערך פריט באופן סיביות.|**ערך** - ערך לבדיקה<br>**bits to shift** (חובה) - מספר סיביות להזזה|סוגי ערכים נתמכים: int<br><br> למרות שההשוואה נעשית בצורה סיבית, יש לספק את כל הערכים ומוחזרים בעשרוניות. לדוגמה, בדיקת הסיביות ה-3 מתבצעת על ידי השוואה ל-4, לא ל-100.|
|**bitxor** (ערך,מסכה)|<|<|
|ערך של "EX בלעדי OR" של ערך פריט ומסכה.|**ערך** - ערך לבדיקה<br>**מסכה** (חובה) - מספר שלם ללא סימן של 64 סיביות (0 - 18446744073709551615)|ערך נתמך types: int<br><br>למרות שההשוואה נעשית בצורה סיבית, יש לספק את כל הערכים ומוחזרים בעשרוניות. לדוגמה, בדיקת הסיביות ה-3 מתבצעת על ידי השוואה ל-4, לא ל-100.|

[comment]: # ({/5317f435-ca911365})

[comment]: # ({new-80c8d9ba})
### 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
    `<` `>`

[comment]: # ({/new-80c8d9ba})

[comment]: # ({new-ba090b44})

##### bitand(value,mask) {#bitand}

The value of "bitwise AND" of an item value and mask.<br>
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

[comment]: # ({/new-ba090b44})

[comment]: # ({new-5b5c2f3e})

##### bitlshift(value,bits to shift) {#bitlshift}

The bitwise shift left of an item value.<br>
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.

[comment]: # ({/new-5b5c2f3e})

[comment]: # ({new-ac54222f})

##### bitnot(value) {#bitnot}

The value of "bitwise NOT" of an item value.<br>
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.

[comment]: # ({/new-ac54222f})

[comment]: # ({new-e0357d53})

##### bitor(value,mask) {#bitor}

The value of "bitwise OR" of an item value and mask.<br>
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.

[comment]: # ({/new-e0357d53})

[comment]: # ({new-2fbc8601})

##### bitrshift(value,bits to shift) {#bitrshift}

The bitwise shift right of an item value.<br>
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.

[comment]: # ({/new-2fbc8601})

[comment]: # ({new-2d663611})

##### bitxor(value,mask) {#bitxor}

The value of "bitwise exclusive OR" of an item value and mask.<br>
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.

[comment]: # ({/new-2d663611})

[comment]: # ({new-540c5e03})

See [all supported functions](/manual/appendix/functions).

[comment]: # ({/new-540c5e03})
