git-svn-id: https://svn.itm.uni-luebeck.de/wisebed/wiselib/trunk/pc_apps/roomba_tests@4002
f8795833-4959-0410-8ae9-
8bcb0cfab428
int nearest_diff(unsigned short last, unsigned short current) {
int d = current - last;
if(d < -0x8000) { // overflow in positive direction
int nearest_diff(unsigned short last, unsigned short current) {
int d = current - last;
if(d < -0x8000) { // overflow in positive direction
- d = (0x10000 - last_i + this_i);
+ d = (0x10000 - last + current);
}
if(d >= 0x8000) { // overflow in negative direction
}
if(d >= 0x8000) { // overflow in negative direction
- d = -(0x10000 - this_i + last_i);
+ d = -(0x10000 - current + last);