aboutsummaryrefslogtreecommitdiff
path: root/include/exec/memop.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-10-04 13:00:47 -0700
committerRichard Henderson <richard.henderson@linaro.org>2024-10-13 11:27:03 -0700
commitda335fe12a5da71a33d7afc2075a341f26213f53 (patch)
treeeb4cc9cba06594e580e5ac8a45fec88d6003b6a5 /include/exec/memop.h
parent49d1866a6e53b84fd0aceced39ee3d01eb77e813 (diff)
downloadqemu-da335fe12a5da71a33d7afc2075a341f26213f53.zip
qemu-da335fe12a5da71a33d7afc2075a341f26213f53.tar.gz
qemu-da335fe12a5da71a33d7afc2075a341f26213f53.tar.bz2
include/exec/memop: Move get_alignment_bits from tcg.h
This function is specific to MemOp, not TCG in general. Reviewed-by: Helge Deller <deller@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/exec/memop.h')
-rw-r--r--include/exec/memop.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/exec/memop.h b/include/exec/memop.h
index f881fe7..97720a8 100644
--- a/include/exec/memop.h
+++ b/include/exec/memop.h
@@ -170,4 +170,27 @@ static inline bool memop_big_endian(MemOp op)
return (op & MO_BSWAP) == MO_BE;
}
+/**
+ * get_alignment_bits
+ * @memop: MemOp value
+ *
+ * Extract the alignment size from the memop.
+ */
+static inline unsigned get_alignment_bits(MemOp memop)
+{
+ unsigned a = memop & MO_AMASK;
+
+ if (a == MO_UNALN) {
+ /* No alignment required. */
+ a = 0;
+ } else if (a == MO_ALIGN) {
+ /* A natural alignment requirement. */
+ a = memop & MO_SIZE;
+ } else {
+ /* A specific alignment requirement. */
+ a = a >> MO_ASHIFT;
+ }
+ return a;
+}
+
#endif