From: Ilia Alshanetsky Date: Wed, 6 Jun 2007 22:58:42 +0000 (+0000) Subject: Optimize out a loop X-Git-Tag: php-5.2.4RC1~394 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a20bba04d56e6f136892c13008b900f2ca694c13;p=php Optimize out a loop --- diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 5e0ec7c1a5..36ce6bc123 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2327,12 +2327,13 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su RETURN_LONG(calc_sunset ? set : rise); } N = (calc_sunset ? h_set : h_rise) + gmt_offset; - while (N > 24) { - N -= 24; - } - while (N < 0) { - N += 24; + + if (N > 24) { + N %= 24; + } else if (N < 0) { + N = N % 24 + 24; } + switch (retformat) { case SUNFUNCS_RET_STRING: spprintf(&retstr, 0, "%02d:%02d", (int) N, (int) (60 * (N - (int) N)));