summaryrefslogtreecommitdiff
path: root/src/core/ao_int64.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-05-22 19:20:54 -0600
committerKeith Packard <keithp@keithp.com>2013-08-25 22:24:01 -0700
commitcb844328322fd7d9f4dafb58b322257a70b347e6 (patch)
tree86a01d45bde34a6801b9f997ed1b6a7adba84754 /src/core/ao_int64.c
parent5ccd902d0fd2adc40c72982babb60fac4da6a087 (diff)
altos: Add 64-bit subtraction
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/core/ao_int64.c')
-rw-r--r--src/core/ao_int64.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/ao_int64.c b/src/core/ao_int64.c
index 5307342d..07cdb357 100644
--- a/src/core/ao_int64.c
+++ b/src/core/ao_int64.c
@@ -27,6 +27,17 @@ void ao_plus64(ao_int64_t *r, ao_int64_t *a, ao_int64_t *b) {
r->low = t;
}
+void ao_minus64(ao_int64_t *r, ao_int64_t *a, ao_int64_t *b) {
+ uint32_t t;
+
+
+ r->high = a->high - b->high;
+ t = a->low - b->low;
+ if (t > a->low)
+ r->high--;
+ r->low = t;
+}
+
void ao_rshift64(ao_int64_t *r, ao_int64_t *a, uint8_t d) {
if (d < 32) {
r->low = a->low >> d;