Message ID | 20201021045149.1582203-3-richard.henderson@linaro.org |
---|---|
State | New |
Headers | show |
Series | softfloat: alternate conversion of float128_addsub | expand |
Richard Henderson <richard.henderson@linaro.org> writes: > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
On 10/21/20 6:51 AM, Richard Henderson wrote: > Signed-off-by: Richard Henderson <richard.henderson@linaro.org> > --- > include/qemu/int128.h | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff --git a/include/qemu/int128.h b/include/qemu/int128.h index 52fc238421..055f202d08 100644 --- a/include/qemu/int128.h +++ b/include/qemu/int128.h @@ -1,9 +1,9 @@ #ifndef INT128_H #define INT128_H -#ifdef CONFIG_INT128 -#include "qemu/bswap.h" +#include "qemu/host-utils.h" +#ifdef CONFIG_INT128 typedef __int128_t Int128; static inline Int128 int128_make64(uint64_t a) @@ -328,4 +328,17 @@ static inline void int128_subfrom(Int128 *a, Int128 b) } #endif /* CONFIG_INT128 */ + +static inline int int128_clz(Int128 a) +{ + uint64_t h = int128_gethi(a); + return h ? clz64(h) : 64 + clz64(int128_getlo(a)); +} + +static inline int int128_ctz(Int128 a) +{ + uint64_t l = int128_getlo(a); + return l ? ctz64(l) : 64 + ctz64(int128_gethi(a)); +} + #endif /* INT128_H */
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> --- include/qemu/int128.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)