summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMichael Brown2015-11-24 18:28:23 +0100
committerMichael Brown2015-12-02 00:56:27 +0100
commit1fcd4223cc5bce800bf253ab34cbf2e996c9958e (patch)
treec28d80e8b35fda180c3dcc97e65fa2e2d6e89970 /src/include
parent[smsc95xx] Add driver for SMSC/Microchip LAN95xx USB Ethernet NICs (diff)
downloadipxe-1fcd4223cc5bce800bf253ab34cbf2e996c9958e.tar.gz
ipxe-1fcd4223cc5bce800bf253ab34cbf2e996c9958e.tar.xz
ipxe-1fcd4223cc5bce800bf253ab34cbf2e996c9958e.zip
[bitops] Provide BIT_QWORD_PTR()
Provide BIT_QWORD_PTR() to allow for easy extraction of non-endian fields (e.g. Infiniband GUIDs) without unnecessary byte swapping. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ipxe/bitops.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/ipxe/bitops.h b/src/include/ipxe/bitops.h
index 2e22c1dbc..93eb663e2 100644
--- a/src/include/ipxe/bitops.h
+++ b/src/include/ipxe/bitops.h
@@ -212,6 +212,13 @@ typedef unsigned char pseudo_bit_t;
BIT_ASSEMBLE_6 ( _ptr, QWORD_OFFSET ( _ptr, _field1 ), \
_field1, __VA_ARGS__ ) )
+#define BIT_QWORD_PTR( _ptr, _field ) \
+ ( { \
+ unsigned int __index = QWORD_OFFSET ( _ptr, _field ); \
+ uint64_t *__ptr = &(_ptr)->u.qwords[__index]; \
+ __ptr; \
+ } )
+
/** Extract value of named field */
#define BIT_GET64( _ptr, _field ) \
( { \