mirror of
https://github.com/qemu/qemu.git
synced 2024-12-05 01:33:41 +08:00
qemu/int128: Add int128_{not,xor}
Addition of not and xor on 128-bit integers. Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr> Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org> Message-Id: <20211025122818.168890-3-frederic.petrot@univ-grenoble-alpes.fr> [rth: Split out logical operations.] Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
c52d69e7db
commit
1c46937358
@ -58,6 +58,11 @@ static inline Int128 int128_exts64(int64_t a)
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline Int128 int128_not(Int128 a)
|
||||||
|
{
|
||||||
|
return ~a;
|
||||||
|
}
|
||||||
|
|
||||||
static inline Int128 int128_and(Int128 a, Int128 b)
|
static inline Int128 int128_and(Int128 a, Int128 b)
|
||||||
{
|
{
|
||||||
return a & b;
|
return a & b;
|
||||||
@ -68,6 +73,11 @@ static inline Int128 int128_or(Int128 a, Int128 b)
|
|||||||
return a | b;
|
return a | b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline Int128 int128_xor(Int128 a, Int128 b)
|
||||||
|
{
|
||||||
|
return a ^ b;
|
||||||
|
}
|
||||||
|
|
||||||
static inline Int128 int128_rshift(Int128 a, int n)
|
static inline Int128 int128_rshift(Int128 a, int n)
|
||||||
{
|
{
|
||||||
return a >> n;
|
return a >> n;
|
||||||
@ -235,6 +245,11 @@ static inline Int128 int128_exts64(int64_t a)
|
|||||||
return int128_make128(a, (a < 0) ? -1 : 0);
|
return int128_make128(a, (a < 0) ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline Int128 int128_not(Int128 a)
|
||||||
|
{
|
||||||
|
return int128_make128(~a.lo, ~a.hi);
|
||||||
|
}
|
||||||
|
|
||||||
static inline Int128 int128_and(Int128 a, Int128 b)
|
static inline Int128 int128_and(Int128 a, Int128 b)
|
||||||
{
|
{
|
||||||
return int128_make128(a.lo & b.lo, a.hi & b.hi);
|
return int128_make128(a.lo & b.lo, a.hi & b.hi);
|
||||||
@ -245,6 +260,11 @@ static inline Int128 int128_or(Int128 a, Int128 b)
|
|||||||
return int128_make128(a.lo | b.lo, a.hi | b.hi);
|
return int128_make128(a.lo | b.lo, a.hi | b.hi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline Int128 int128_xor(Int128 a, Int128 b)
|
||||||
|
{
|
||||||
|
return int128_make128(a.lo ^ b.lo, a.hi ^ b.hi);
|
||||||
|
}
|
||||||
|
|
||||||
static inline Int128 int128_rshift(Int128 a, int n)
|
static inline Int128 int128_rshift(Int128 a, int n)
|
||||||
{
|
{
|
||||||
int64_t h;
|
int64_t h;
|
||||||
|
Loading…
Reference in New Issue
Block a user