[Ffmpeg-devel] [PATCH] qcelp codec supporrt

Rich Felker dalias
Thu Dec 14 19:56:28 CET 2006


On Thu, Dec 14, 2006 at 10:28:33AM +0100, Michel Bardiaux wrote:
> >>Conversion to unsigned is well-defined.  Conversion to signed is only
> >>defined when the value is within the range of the target type.  This
> >>is mostly because the C standard doesn't specify how negative numbers
> >>are represented.  Apparently there were some machines in the distant
> >>past that used one's complement to represent negative numbers.
> >
> >Because their creators failed MATH 101... For all practical purposes,
> >all arithmetic is twos complement and signed truncation is well-defined.
> >
> >Rich
> 
> Seymour Cray failing math101?

I didn't know the man, but mathematically speaking "ones complement"
is utterly idiotic. It's inventing two special cases for something
which is simpler, more efficient, more functional (1 extra value), and
non-ambiguous if you do it in number-theoretically correct way, "twos
complement", which is just arithmetic modulo 2^n where the concent of
signedness does not even exist.

Rich




More information about the ffmpeg-devel mailing list