SET_FIELD allows to set bits[last:first] with the given value.
Signed-off-by: Alice Guo <[email protected]>
---
hypervisor/include/jailhouse/utils.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hypervisor/include/jailhouse/utils.h
b/hypervisor/include/jailhouse/utils.h
index 411f6365..21243082 100644
--- a/hypervisor/include/jailhouse/utils.h
+++ b/hypervisor/include/jailhouse/utils.h
@@ -35,5 +35,9 @@
#define GET_FIELD(value, last, first) \
(((value) & BIT_MASK((last), (first))) >> (first))
+/* set the field value at [last:first] from an input of up to 64 bits*/
+#define SET_FIELD(value, last, first) \
+ ((value) << (first) & BIT_MASK((last), (first)))
+
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
--
2.17.1
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/20200917040554.4599-3-alice.guo%40nxp.com.