[XviD-devel] Don't do " signed /= unsigned "

Radek Czyz xvid-devel@xvid.org
Sun, 12 Jan 2003 00:39:03 +1030


Hi,

gruel wrote

> In branch motion_comp.c there is a line

> dx /= (1+quarterpel)

> and this gives me wrong results if dx is signed int (which it is)
> and quarterpel is unsigned (which I declared that way, since it's a 0 or
> 1 flag). Division is then done unsigned!

now you know why I made this signed ;)

I think that division is faster than if - am I correct? However, I'm
sure that some kind of bitshift would be even faster... do you know a
way to make it a bitshift, but dividing negative values correctly?

Radek

PS: @gruel, how's your GME going? :)