From 7fefa0fbf55c2975b917e948187a0d0d1159ccdc Mon Sep 17 00:00:00 2001 From: Antoine Sauzeau Date: Wed, 10 Sep 2025 15:04:59 +0200 Subject: [PATCH] docs(vrl): Add vrl bitwise operators AND, OR and NOT documentation Signed-off-by: Antoine Sauzeau --- .../reference/remap/expressions/bitwise.cue | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 website/cue/reference/remap/expressions/bitwise.cue diff --git a/website/cue/reference/remap/expressions/bitwise.cue b/website/cue/reference/remap/expressions/bitwise.cue new file mode 100644 index 0000000000000..ed6436ee5b596 --- /dev/null +++ b/website/cue/reference/remap/expressions/bitwise.cue @@ -0,0 +1,58 @@ +package metadata + +remap: expressions: bitwise: { + title: "Bitwise" + description: """ + A _bitwise_ expression performs an operation directly on the individual bits of integer operands. + """ + return: """ + Returns the result of the expression as defined by the operator. + """ + + grammar: { + source: """ + expression ~ operator ~ expression + """ + definitions: { + expression: { + description: """ + The `expression` can be any expression that returns an integer. + """ + } + operator: { + description: """ + The `operator` defines the operation performed on the left-hand-side and right-hand-side operands. + """ + enum: { + "&": "Bitwise AND. Operates on `int` type." + "^": "Bitwise OR. Operates on `int` type." + "~": "Bitwise NOT. Operates on `int` type." + } + } + } + } + + examples: [ + { + title: "AND" + source: #""" + 1 & 5 + """# + return: 1 + }, + { + title: "OR" + source: #""" + 1 ^ 4 + """# + return: 5 + }, + { + title: "NOT" + source: #""" + ~5 + """# + return: -6 + } + ] +}