Skip to contentSkip to conversation

Add int128_or to include/qemu/int128.h

PATCH In review Taylor Simpson 2 participants 2 messages Oct 28, 2020 – Oct 29, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add int128_or to include/qemu/int128.h

Discovered the need when working on Hexagon target
https://www.mail-archive.com/[email protected]/msg733818.html
Useful as a standalone patch

---
 include/qemu/int128.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/qemu/int128.h +10 -0
index 76ea405..52fc238 100644
@@ -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;
Signature · 1 line
2.7.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Taylor Simpson

Discovered the need when working on Hexagon target
https://www.mail-archive.com/[email protected]/msg733818.html
Useful as a standalone patch

Following the QEMU commits style:

"qemu/int128: Add int128_or()"

Add the int128_or() implementation.

Quoted 35 lines
---
 include/qemu/int128.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
include/qemu/int128.h +10 -0
index 76ea405..52fc238 100644
@@ -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;