mirror of
https://github.com/apache/nuttx.git
synced 2026-08-19 12:38:18 +00:00
libc/stdlib: Fix a few minor coding style issues
This commit is contained in:
parent
41137b82fa
commit
d08596a653
3 changed files with 34 additions and 22 deletions
|
|
@ -140,12 +140,12 @@ double strtod(FAR const char *str, FAR char **endptr)
|
|||
p++;
|
||||
|
||||
while (isdigit(*p))
|
||||
{
|
||||
number = number * 10. + (*p - '0');
|
||||
p++;
|
||||
num_digits++;
|
||||
num_decimals++;
|
||||
}
|
||||
{
|
||||
number = number * 10. + (*p - '0');
|
||||
p++;
|
||||
num_digits++;
|
||||
num_decimals++;
|
||||
}
|
||||
|
||||
exponent -= num_decimals;
|
||||
}
|
||||
|
|
@ -212,7 +212,11 @@ double strtod(FAR const char *str, FAR char **endptr)
|
|||
|
||||
p10 = 10.;
|
||||
n = exponent;
|
||||
if (n < 0) n = -n;
|
||||
if (n < 0)
|
||||
{
|
||||
n = -n;
|
||||
}
|
||||
|
||||
while (n)
|
||||
{
|
||||
if (n & 1)
|
||||
|
|
|
|||
|
|
@ -142,12 +142,12 @@ float strtof(FAR const char *str, FAR char **endptr)
|
|||
p++;
|
||||
|
||||
while (isdigit(*p))
|
||||
{
|
||||
number = number * 10.0F + (float)(*p - '0');
|
||||
p++;
|
||||
num_digits++;
|
||||
num_decimals++;
|
||||
}
|
||||
{
|
||||
number = number * 10.0F + (float)(*p - '0');
|
||||
p++;
|
||||
num_digits++;
|
||||
num_decimals++;
|
||||
}
|
||||
|
||||
exponent -= num_decimals;
|
||||
}
|
||||
|
|
@ -214,7 +214,11 @@ float strtof(FAR const char *str, FAR char **endptr)
|
|||
|
||||
p10 = 10.0F;
|
||||
n = exponent;
|
||||
if (n < 0) n = -n;
|
||||
if (n < 0)
|
||||
{
|
||||
n = -n;
|
||||
}
|
||||
|
||||
while (n)
|
||||
{
|
||||
if (n & 1)
|
||||
|
|
|
|||
|
|
@ -140,12 +140,12 @@ long double strtold(FAR const char *str, FAR char **endptr)
|
|||
p++;
|
||||
|
||||
while (isdigit(*p))
|
||||
{
|
||||
number = number * 10.0L + (long double)(*p - '0');
|
||||
p++;
|
||||
num_digits++;
|
||||
num_decimals++;
|
||||
}
|
||||
{
|
||||
number = number * 10.0L + (long double)(*p - '0');
|
||||
p++;
|
||||
num_digits++;
|
||||
num_decimals++;
|
||||
}
|
||||
|
||||
exponent -= num_decimals;
|
||||
}
|
||||
|
|
@ -210,9 +210,13 @@ long double strtold(FAR const char *str, FAR char **endptr)
|
|||
|
||||
/* Scale the result */
|
||||
|
||||
p10 = 10.;
|
||||
p10 = 10.0L;
|
||||
n = exponent;
|
||||
if (n < 0) n = -n;
|
||||
if (n < 0)
|
||||
{
|
||||
n = -n;
|
||||
}
|
||||
|
||||
while (n)
|
||||
{
|
||||
if (n & 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue