projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Add 64-bit subtraction
[fw/altos]
/
src
/
core
/
ao_int64.c
diff --git
a/src/core/ao_int64.c
b/src/core/ao_int64.c
index 5307342df90704c35e94d93880a3f42357222450..07cdb35731be63d927b963870fa56864efb1b0ac 100644
(file)
--- 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;
}
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;
void ao_rshift64(ao_int64_t *r, ao_int64_t *a, uint8_t d) {
if (d < 32) {
r->low = a->low >> d;