[RFC PATCH 05/15] qemu/int128: Add int128_geu

Richard Henderson posted 15 patches 5 years, 3 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Aurelien Jarno <aurelien@aurel32.net>, Greg Kurz <groug@kaod.org>, Peter Maydell <peter.maydell@linaro.org>, "Alex Bennée" <alex.bennee@linaro.org>, David Gibson <david@gibson.dropbear.id.au>
[RFC PATCH 05/15] qemu/int128: Add int128_geu
Posted by Richard Henderson 5 years, 3 months ago
Add an unsigned inequality operation.  Do not fill in all of
the variations until we have a call for them.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 include/qemu/int128.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/qemu/int128.h b/include/qemu/int128.h
index c53002039a..1f95792a29 100644
--- a/include/qemu/int128.h
+++ b/include/qemu/int128.h
@@ -113,6 +113,11 @@ static inline bool int128_ge(Int128 a, Int128 b)
     return a >= b;
 }
 
+static inline bool int128_geu(Int128 a, Int128 b)
+{
+    return (__uint128_t)a >= (__uint128_t)b;
+}
+
 static inline bool int128_lt(Int128 a, Int128 b)
 {
     return a < b;
@@ -303,6 +308,11 @@ static inline bool int128_ge(Int128 a, Int128 b)
     return a.hi > b.hi || (a.hi == b.hi && a.lo >= b.lo);
 }
 
+static inline bool int128_geu(Int128 a, Int128 b)
+{
+    return (uint64_t)a.hi > (uint64_t)b.hi || (a.hi == b.hi && a.lo >= b.lo);
+}
+
 static inline bool int128_lt(Int128 a, Int128 b)
 {
     return !int128_ge(a, b);
-- 
2.25.1


Re: [RFC PATCH 05/15] qemu/int128: Add int128_geu
Posted by Philippe Mathieu-Daudé 4 years, 12 months ago
On 10/21/20 6:51 AM, Richard Henderson wrote:
> Add an unsigned inequality operation.  Do not fill in all of
> the variations until we have a call for them.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  include/qemu/int128.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)

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