[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH][for-4.19 1/9] xen/include: add macro LOWEST_POW2



On 06/10/2023 18:35, andrew.cooper3@xxxxxxxxxx wrote:
On 06/10/2023 9:26 am, Nicola Vetrini wrote:
diff --git a/xen/include/xen/macros.h b/xen/include/xen/macros.h
index d0caae7db298..bb9a1c9a53d0 100644
--- a/xen/include/xen/macros.h
+++ b/xen/include/xen/macros.h
@@ -8,8 +8,10 @@
 #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))
+#define LOWEST_POW2(x) ((x) & -(x))

Naming wise, LOWEST_BIT() please.

The fact it's a power of two is incidental, and POW2 is ambiguous,
because it includes interpretations such as "calculate the lowest power
of two greater than x".

~Andrew

You have a point. I'll change it.

--
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.