Skip to content

Commit

Permalink
Replaced while loop with mod operator.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Oct 10, 2009
1 parent 33e59e1 commit 1eb54a3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions effect_position.c
Expand Up @@ -1295,9 +1295,7 @@ static void set_amplitudes(int channels, int angle, int room_angle)
int left = 255, right = 255;
int left_rear = 255, right_rear = 255, center = 255;

/* unwind the angle...it'll be between 0 and 359. */
while (angle >= 360) angle -= 360;
while (angle < 0) angle += 360;
angle = SDL_abs(angle) % 360; /* make angle between 0 and 359. */

if (channels == 2)
{
Expand Down Expand Up @@ -1530,9 +1528,7 @@ int Mix_SetPosition(int channel, Sint16 angle, Uint8 distance)
if (f == NULL)
return(0);

/* unwind the angle...it'll be between 0 and 359. */
while (angle >= 360) angle -= 360;
while (angle < 0) angle += 360;
angle = SDL_abs(angle) % 360; /* make angle between 0 and 359. */

args = get_position_arg(channel);
if (!args)
Expand Down

0 comments on commit 1eb54a3

Please sign in to comment.