Replaced while loop with mod operator.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 10 Oct 2009 16:38:34 +0000
changeset 440fc0d5e4bc358
parent 439 61df4c58cf39
child 441 f86cc112a195
Replaced while loop with mod operator.
effect_position.c
     1.1 --- a/effect_position.c	Sat Oct 10 16:31:25 2009 +0000
     1.2 +++ b/effect_position.c	Sat Oct 10 16:38:34 2009 +0000
     1.3 @@ -1295,9 +1295,7 @@
     1.4      int left = 255, right = 255;
     1.5      int left_rear = 255, right_rear = 255, center = 255;
     1.6  
     1.7 -        /* unwind the angle...it'll be between 0 and 359. */
     1.8 -    while (angle >= 360) angle -= 360;
     1.9 -    while (angle < 0) angle += 360;
    1.10 +    angle = SDL_abs(angle) % 360;  /* make angle between 0 and 359. */
    1.11  
    1.12      if (channels == 2)
    1.13      {
    1.14 @@ -1530,9 +1528,7 @@
    1.15      if (f == NULL)
    1.16          return(0);
    1.17  
    1.18 -        /* unwind the angle...it'll be between 0 and 359. */
    1.19 -    while (angle >= 360) angle -= 360;
    1.20 -    while (angle < 0) angle += 360;
    1.21 +    angle = SDL_abs(angle) % 360;  /* make angle between 0 and 359. */
    1.22  
    1.23      args = get_position_arg(channel);
    1.24      if (!args)