# HG changeset patch # User reimar # Date 1239998727 0 # Node ID 9157421b623925312aa81ef23291411847ae5abf # Parent 7075d0be5ec42862708ac5395bfc9c9f46ad3cfa Use sign_extend function instead of reimplementing it. diff -r 7075d0be5ec4 -r 9157421b6239 xan.c --- a/xan.c Fri Apr 17 20:01:45 2009 +0000 +++ b/xan.c Fri Apr 17 20:05:27 2009 +0000 @@ -333,16 +333,10 @@ } } else { /* run-based motion compensation from last frame */ - motion_x = *vector_segment >> 4; - motion_y = *vector_segment & 0xF; + motion_x = sign_extend(*vector_segment >> 4, 4); + motion_y = sign_extend(*vector_segment & 0xF, 4); vector_segment++; - /* sign extension */ - if (motion_x & 0x8) - motion_x |= 0xFFFFFFF0; - if (motion_y & 0x8) - motion_y |= 0xFFFFFFF0; - /* copy a run of pixels from the previous frame */ xan_wc3_copy_pixel_run(s, x, y, size, motion_x, motion_y);