[PATCH v2 5/7] include: import {lower,upper}_32_bits helpers

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

 



This imports {lower,upper}_32_bits defines to allow to get upper
and lower 32b part of a 64b number.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@xxxxxxxxx>
---
To: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Cc: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxxxxxxxxx>
Cc: Ezequiel Garcia <ezequiel.garcia@xxxxxxxxxxxxxxxxxx>
Cc: barebox@xxxxxxxxxxxxxxxxxxx
---
 include/common.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/common.h b/include/common.h
index ca817aac4f06..de635718d2fe 100644
--- a/include/common.h
+++ b/include/common.h
@@ -282,6 +282,22 @@ void barebox_set_hostname(const char *);
 }							\
 )
 
+/**
+ * upper_32_bits - return bits 32-63 of a number
+ * @n: the number we're accessing
+ *
+ * A basic shift-right of a 64- or 32-bit quantity.  Use this to suppress
+ * the "right shift count >= width of type" warning when that quantity is
+ * 32-bits.
+ */
+#define upper_32_bits(n)	((u32)(((n) >> 16) >> 16))
+
+/**
+ * lower_32_bits - return bits 0-31 of a number
+ * @n: the number we're accessing
+ */
+#define lower_32_bits(n)	((u32)(n))
+
 #define abs(x) ({                               \
 		long __x = (x);                 \
 		(__x < 0) ? -__x : __x;         \
-- 
2.0.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux