Skip to main content

Module operators

Module operators 

Source
Expand description

Operator application for magic rule evaluation

This module provides functions for applying comparison and bitwise operators to values during magic rule evaluation. It handles type-safe comparisons between different Value variants. Supports XOR (^), NOT (~), and any-value (x) matching in addition to equality, comparison, and bitwise AND.

Functions§

apply_any_value
Apply any-value operator: always returns true (unconditional match).
apply_bitwise_and
Apply bitwise AND operation for pattern matching
apply_bitwise_and_mask
Apply bitwise AND with mask for masked comparison
apply_bitwise_not
Apply bitwise NOT then compare with right value
apply_bitwise_not_with_width
Apply bitwise NOT with type-aware bit-width masking
apply_bitwise_xor
Apply bitwise XOR operation for pattern matching
apply_equal
Apply equality comparison between two values
apply_greater_equal
Apply greater-than-or-equal comparison between two values
apply_greater_than
Apply greater-than comparison between two values
apply_less_equal
Apply less-than-or-equal comparison between two values
apply_less_than
Apply less-than comparison between two values
apply_not_equal
Apply inequality comparison between two values
apply_operator
Apply operator to two values using the specified operator type
apply_value_transform
Apply a magic-file pre-comparison ValueTransform to a numeric value read from the file. The result is what the rule’s comparison operator sees, and what printf-style format specifiers (%d, %x, …) render into the message.
compare_values
Compare two values and return their ordering, if comparable