Don't rely on boolean expression evaluating to 1 or 0 by default.

Found by:       FlexeLint
This commit is contained in:
Poul-Henning Kamp 2003-05-31 20:23:46 +00:00
parent 30f5ad0faf
commit 9a3454805e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=115544
2 changed files with 2 additions and 2 deletions

View File

@ -105,7 +105,7 @@ static void setup_8254_mixed_mode(void);
* 32-bit time_t's can't reach leap years before 1904 or after 2036, so we * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we
* can use a simple formula for leap years. * can use a simple formula for leap years.
*/ */
#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) #define LEAPYEAR(y) (((u_int)(y) % 4 == 0) ? 1 : 0)
#define DAYSPERYEAR (31+28+31+30+31+30+31+31+30+31+30+31) #define DAYSPERYEAR (31+28+31+30+31+30+31+31+30+31+30+31)
#define TIMER_DIV(x) ((timer_freq + (x) / 2) / (x)) #define TIMER_DIV(x) ((timer_freq + (x) / 2) / (x))

View File

@ -105,7 +105,7 @@ static void setup_8254_mixed_mode(void);
* 32-bit time_t's can't reach leap years before 1904 or after 2036, so we * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we
* can use a simple formula for leap years. * can use a simple formula for leap years.
*/ */
#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) #define LEAPYEAR(y) (((u_int)(y) % 4 == 0) ? 1 : 0)
#define DAYSPERYEAR (31+28+31+30+31+30+31+31+30+31+30+31) #define DAYSPERYEAR (31+28+31+30+31+30+31+31+30+31+30+31)
#define TIMER_DIV(x) ((timer_freq + (x) / 2) / (x)) #define TIMER_DIV(x) ((timer_freq + (x) / 2) / (x))