From a quick look, shouldn't you do the rrc and rlc the other way round
when subtracting, compared to adding?
Regards,
Harri
At 05:30 PM 11/16/2005 +0100, Andrea Pacini wrote:
I am going crazy about why this assembly code works :
/* SUM BETWEEN LARGE INTEGERS */
for (i = 0; i < digits; i++) {
asm volatile ("rrc %1 \n\t"
"addc %3, %2 \n\t"
"mov %2, %0 \n\t"
"rlc %1 \n\t"
:"=r"(a[i]),"+r"(carry)
:"r"(b[i]), "r"(c[i])
);
}
and this other doesn't work :
/* DIFFERENCE BETWEEN LARGE INTEGERS */
for (i = 0; i < digits; i++) {
asm volatile ( "rrc %1 \n\t"
"subc %3, %2 \n\t"
"mov %2,%0 \n\t"
"rlc %1 \n\t"
:"=r"(a[i]), "+r"(borrow)
:"r"(b[i]), "r"(c[i])
);
}
The first does sum between two large integer (array), b and c, and result
is stored in a , and it works fine
The second does difference but it doesnt' work !!!
The only difference is that in the second I use subc instead of addc.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help