comparison was always false due to limited range of data types.

Carefully cast to unsigned long long prior to multiply to get
the expected result.
This commit is contained in:
Eric Andersen 2003-09-15 08:11:29 +00:00
parent 1393a39df4
commit 2205c84de4

View File

@ -333,7 +333,7 @@ static unsigned int check_free_memory(void)
s--;
}
result = (info.totalram >> s) + (info.totalswap >> s);
if ((unsigned long long) (result * u) > UINT_MAX) {
if (((unsigned long long)result * (unsigned long long)u) > UINT_MAX) {
return(UINT_MAX);
} else {
return(result * u);