summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sail.c9
-rw-r--r--lib/sail.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/sail.c b/lib/sail.c
index 1753ab8e..94065f0a 100644
--- a/lib/sail.c
+++ b/lib/sail.c
@@ -837,6 +837,15 @@ fbits bitvector_access(const lbits op, const sail_int n_mpz)
return (fbits) mpz_tstbit(*op.bits, n);
}
+fbits update_fbits(const fbits op, const uint64_t n, const fbits bit)
+{
+ if ((bit & 1) == 1) {
+ return op | (bit << n);
+ } else {
+ return op & ~(bit << n);
+ }
+}
+
void sail_unsigned(sail_int *rop, const lbits op)
{
/* Normal form of bv_t is always positive so just return the bits. */
diff --git a/lib/sail.h b/lib/sail.h
index f5ff0eaa..fbbce541 100644
--- a/lib/sail.h
+++ b/lib/sail.h
@@ -288,6 +288,8 @@ void sail_truncateLSB(lbits *rop, const lbits op, const sail_int len);
fbits bitvector_access(const lbits op, const sail_int n_mpz);
+fbits update_fbits(const fbits op, const uint64_t n, const fbits bit);
+
void sail_unsigned(sail_int *rop, const lbits op);
void sail_signed(sail_int *rop, const lbits op);