diff mbox series

Add int128_or to include/qemu/int128.h

Message ID 1603919949-17498-1-git-send-email-tsimpson@quicinc.com
State New
Headers show
Series Add int128_or to include/qemu/int128.h | expand

Commit Message

Taylor Simpson Oct. 28, 2020, 9:19 p.m. UTC
Discovered the need when working on Hexagon target
https://www.mail-archive.com/qemu-devel@nongnu.org/msg733818.html
Useful as a standalone patch

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
---
 include/qemu/int128.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Philippe Mathieu-Daudé Oct. 29, 2020, 7 a.m. UTC | #1
On 10/28/20 10:19 PM, Taylor Simpson wrote:
> Discovered the need when working on Hexagon target

> https://www.mail-archive.com/qemu-devel@nongnu.org/msg733818.html

> Useful as a standalone patch


Following the QEMU commits style:

"qemu/int128: Add int128_or()"

Add the int128_or() implementation.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>


> 

> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>

> ---

>  include/qemu/int128.h | 10 ++++++++++

>  1 file changed, 10 insertions(+)

> 

> diff --git a/include/qemu/int128.h b/include/qemu/int128.h

> index 76ea405..52fc238 100644

> --- a/include/qemu/int128.h

> +++ b/include/qemu/int128.h

> @@ -58,6 +58,11 @@ static inline Int128 int128_and(Int128 a, Int128 b)

>      return a & b;

>  }

>  

> +static inline Int128 int128_or(Int128 a, Int128 b)

> +{

> +    return a | b;

> +}

> +

>  static inline Int128 int128_rshift(Int128 a, int n)

>  {

>      return a >> n;

> @@ -208,6 +213,11 @@ static inline Int128 int128_and(Int128 a, Int128 b)

>      return (Int128) { a.lo & b.lo, a.hi & b.hi };

>  }

>  

> +static inline Int128 int128_or(Int128 a, Int128 b)

> +{

> +    return (Int128) { a.lo | b.lo, a.hi | b.hi };

> +}

> +

>  static inline Int128 int128_rshift(Int128 a, int n)

>  {

>      int64_t h;

>
diff mbox series

Patch

diff --git a/include/qemu/int128.h b/include/qemu/int128.h
index 76ea405..52fc238 100644
--- a/include/qemu/int128.h
+++ b/include/qemu/int128.h
@@ -58,6 +58,11 @@  static inline Int128 int128_and(Int128 a, Int128 b)
     return a & b;
 }
 
+static inline Int128 int128_or(Int128 a, Int128 b)
+{
+    return a | b;
+}
+
 static inline Int128 int128_rshift(Int128 a, int n)
 {
     return a >> n;
@@ -208,6 +213,11 @@  static inline Int128 int128_and(Int128 a, Int128 b)
     return (Int128) { a.lo & b.lo, a.hi & b.hi };
 }
 
+static inline Int128 int128_or(Int128 a, Int128 b)
+{
+    return (Int128) { a.lo | b.lo, a.hi | b.hi };
+}
+
 static inline Int128 int128_rshift(Int128 a, int n)
 {
     int64_t h;