[SDL] Best way to rotate a sprite?
phillips at arcor.de
Tue Jan 28 17:34:01 PST 2003
On Tuesday 28 January 2003 23:30, Sami Näätänen wrote:
> On Tuesday 28 January 2003 22:54, Sami Näätänen wrote:
> In fact the above thing doesn't work correctly, because the C standard
> defines the %-operator as mathematically correct reminder operation.
> So the -1 % 32 = -1, but we want it to be 31.
You meant to say the C standard defines the % operator as the mathematically
*incorrect* remainder, otherwise known as truncation towards zero, and
formally defined as discarding any fractional part of the result. This is
purely for efficiency - mathematically it's offensive, but unfortunately we
can't go back in time and add the few extra transistors it would have taken
to do the job properly in the early CPUs.
More information about the SDL