[PATCH v2 03/21] include/exec/memop: Move get_alignment_bits from tcg.h

Richard Henderson posted 21 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH v2 03/21] include/exec/memop: Move get_alignment_bits from tcg.h
Posted by Richard Henderson 1 month, 2 weeks ago
This function is specific to MemOp, not TCG in general.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/exec/memop.h | 23 +++++++++++++++++++++++
 include/tcg/tcg.h    | 23 -----------------------
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/include/exec/memop.h b/include/exec/memop.h
index f881fe7af4..97720a8ee7 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
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
index 21d5884741..824fb3560d 100644
--- a/include/tcg/tcg.h
+++ b/include/tcg/tcg.h
@@ -281,29 +281,6 @@ static inline int tcg_type_size(TCGType t)
     return 4 << i;
 }
 
-/**
- * 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;
-}
-
 typedef tcg_target_ulong TCGArg;
 
 /* Define type and accessor macros for TCG variables.
-- 
2.43.0
Re: [PATCH v2 03/21] include/exec/memop: Move get_alignment_bits from tcg.h
Posted by Peter Maydell 1 month, 2 weeks ago
On Sat, 5 Oct 2024 at 21:06, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> This function is specific to MemOp, not TCG in general.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Re: [PATCH v2 03/21] include/exec/memop: Move get_alignment_bits from tcg.h
Posted by Helge Deller 1 month, 2 weeks ago
On 10/5/24 22:05, Richard Henderson wrote:
> This function is specific to MemOp, not TCG in general.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Helge Deller <deller@gmx.de>


> ---
>   include/exec/memop.h | 23 +++++++++++++++++++++++
>   include/tcg/tcg.h    | 23 -----------------------
>   2 files changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/include/exec/memop.h b/include/exec/memop.h
> index f881fe7af4..97720a8ee7 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
> diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
> index 21d5884741..824fb3560d 100644
> --- a/include/tcg/tcg.h
> +++ b/include/tcg/tcg.h
> @@ -281,29 +281,6 @@ static inline int tcg_type_size(TCGType t)
>       return 4 << i;
>   }
>
> -/**
> - * 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;
> -}
> -
>   typedef tcg_target_ulong TCGArg;
>
>   /* Define type and accessor macros for TCG variables.