-config=MC3R1.R10.1,etypes+={safe, "stmt(operator(logical)||node(conditional_operator||binary_conditional_operator))", "dst_type(ebool||boolean)"}
-doc_end
+-doc_begin="The macro ISOLATE_LSB encapsulates a well-known pattern to obtain
+a mask where only the lowest bit set in the argument is set, if any, for unsigned
+integers arguments on two's complement architectures
+(all the architectures supported by Xen satisfy this requirement)."
+-config=MC3R1.R10.1,reports+={safe, "any_area(any_loc(any_exp(macro(^ISOLATE_LSB$))))"}
+-doc_end
+
### Set 3 ###
#
See automation/eclair_analysis/deviations.ecl for the full explanation.
- Tagged as `safe` for ECLAIR.
+ * - R10.1
+ - The macro ISOLATE_LSB encapsulates the well-known pattern (x & -x)
+ applied to unsigned integer values on 2's complement architectures
+ (i.e., all architectures supported by Xen), used to obtain a mask where
+ just the least significant nonzero bit of x is set.
+ If no bits are set, 0 is returned.
+ - Tagged as `safe` for ECLAIR.
+
* - R13.5
- All developers and reviewers can be safely assumed to be well aware of
the short-circuit evaluation strategy for logical operators.
#define DIV_ROUND(n, d) (((n) + (d) / 2) / (d))
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
-#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
-#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
+/*
+ * Given an unsigned integer argument, expands to a mask where just the least
+ * significant nonzero bit of the argument is set, or 0 if no bits are set.
+ */
+#define ISOLATE_LSB(x) ((x) & -(x))
+
+#define MASK_EXTR(v, m) (((v) & (m)) / ISOLATE_LSB(m))
+#define MASK_INSR(v, m) (((v) * ISOLATE_LSB(m)) & (m))
#define count_args_(dot, a1, a2, a3, a4, a5, a6, a7, a8, x, ...) x
#define count_args(args...) \