aboutsummaryrefslogtreecommitdiff
path: root/sim/common/cgen-utils.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-07-19 23:30:11 +0000
committerJason Molenda <jmolenda@apple.com>1999-07-19 23:30:11 +0000
commitadf40b2e16832f7382ee79e498d43a70ad22e305 (patch)
tree933de2a465a4003b9016471a466079459693ae3e /sim/common/cgen-utils.c
parentdc9e099fc0eced486ae2b49455c9da113c11f4ff (diff)
downloadgdb-adf40b2e16832f7382ee79e498d43a70ad22e305.zip
gdb-adf40b2e16832f7382ee79e498d43a70ad22e305.tar.gz
gdb-adf40b2e16832f7382ee79e498d43a70ad22e305.tar.bz2
import gdb-1999-07-19 snapshot
Diffstat (limited to 'sim/common/cgen-utils.c')
-rw-r--r--sim/common/cgen-utils.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index b1c9f02..1ad5ce7 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -320,3 +320,38 @@ CONVDISI (val)
}
#endif /* DI_FN_SUPPORT */
+
+SI
+RORSI (val, shift)
+ SI val;
+ int shift;
+{
+ if (shift != 0)
+ {
+ int remain = 32 - shift;
+ int mask = (1 << shift) - 1;
+ SI result = (val & mask) << remain;
+ mask = (1 << remain) - 1;
+ result |= (val >> shift) & mask;
+ return result;
+ }
+ return val;
+}
+
+SI
+ROLSI (val, shift)
+ SI val;
+ int shift;
+{
+ if (shift != 0)
+ {
+ int remain = 32 - shift;
+ int mask = (1 << remain) - 1;
+ SI result = (val & mask) << shift;
+ mask = (1 << shift) - 1;
+ result |= (val >> remain) & mask;
+ return result;
+ }
+
+ return val;
+}