diff options
Diffstat (limited to 'lib/strnumcmp-in.h')
-rw-r--r-- | lib/strnumcmp-in.h | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/lib/strnumcmp-in.h b/lib/strnumcmp-in.h index db2d15875..886427490 100644 --- a/lib/strnumcmp-in.h +++ b/lib/strnumcmp-in.h @@ -77,28 +77,28 @@ fraccompare (char const *a, char const *b, char decimal_point) if (*a == decimal_point && *b == decimal_point) { while (*++a == *++b) - if (! ISDIGIT (*a)) - return 0; + if (! ISDIGIT (*a)) + return 0; if (ISDIGIT (*a) && ISDIGIT (*b)) - return *a - *b; + return *a - *b; if (ISDIGIT (*a)) - goto a_trailing_nonzero; + goto a_trailing_nonzero; if (ISDIGIT (*b)) - goto b_trailing_nonzero; + goto b_trailing_nonzero; return 0; } else if (*a++ == decimal_point) { a_trailing_nonzero: while (*a == NUMERIC_ZERO) - a++; + a++; return ISDIGIT (*a); } else if (*b++ == decimal_point) { b_trailing_nonzero: while (*b == NUMERIC_ZERO) - b++; + b++; return - ISDIGIT (*b); } return 0; @@ -113,7 +113,7 @@ fraccompare (char const *a, char const *b, char decimal_point) static inline int numcompare (char const *a, char const *b, - int decimal_point, int thousands_sep) + int decimal_point, int thousands_sep) { unsigned char tmpa = *a; unsigned char tmpb = *b; @@ -124,119 +124,119 @@ numcompare (char const *a, char const *b, if (tmpa == NEGATION_SIGN) { do - tmpa = *++a; + tmpa = *++a; while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep); if (tmpb != NEGATION_SIGN) - { - if (tmpa == decimal_point) - do - tmpa = *++a; - while (tmpa == NUMERIC_ZERO); - if (ISDIGIT (tmpa)) - return -1; - while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep) - tmpb = *++b; - if (tmpb == decimal_point) - do - tmpb = *++b; - while (tmpb == NUMERIC_ZERO); - return - ISDIGIT (tmpb); - } + { + if (tmpa == decimal_point) + do + tmpa = *++a; + while (tmpa == NUMERIC_ZERO); + if (ISDIGIT (tmpa)) + return -1; + while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep) + tmpb = *++b; + if (tmpb == decimal_point) + do + tmpb = *++b; + while (tmpb == NUMERIC_ZERO); + return - ISDIGIT (tmpb); + } do - tmpb = *++b; + tmpb = *++b; while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep); while (tmpa == tmpb && ISDIGIT (tmpa)) - { - do - tmpa = *++a; - while (tmpa == thousands_sep); - do - tmpb = *++b; - while (tmpb == thousands_sep); - } + { + do + tmpa = *++a; + while (tmpa == thousands_sep); + do + tmpb = *++b; + while (tmpb == thousands_sep); + } if ((tmpa == decimal_point && !ISDIGIT (tmpb)) - || (tmpb == decimal_point && !ISDIGIT (tmpa))) - return fraccompare (b, a, decimal_point); + || (tmpb == decimal_point && !ISDIGIT (tmpa))) + return fraccompare (b, a, decimal_point); tmp = tmpb - tmpa; for (log_a = 0; ISDIGIT (tmpa); ++log_a) - do - tmpa = *++a; - while (tmpa == thousands_sep); + do + tmpa = *++a; + while (tmpa == thousands_sep); for (log_b = 0; ISDIGIT (tmpb); ++log_b) - do - tmpb = *++b; - while (tmpb == thousands_sep); + do + tmpb = *++b; + while (tmpb == thousands_sep); if (log_a != log_b) - return log_a < log_b ? 1 : -1; + return log_a < log_b ? 1 : -1; if (!log_a) - return 0; + return 0; return tmp; } else if (tmpb == NEGATION_SIGN) { do - tmpb = *++b; + tmpb = *++b; while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep); if (tmpb == decimal_point) - do - tmpb = *++b; - while (tmpb == NUMERIC_ZERO); + do + tmpb = *++b; + while (tmpb == NUMERIC_ZERO); if (ISDIGIT (tmpb)) - return 1; + return 1; while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep) - tmpa = *++a; + tmpa = *++a; if (tmpa == decimal_point) - do - tmpa = *++a; - while (tmpa == NUMERIC_ZERO); + do + tmpa = *++a; + while (tmpa == NUMERIC_ZERO); return ISDIGIT (tmpa); } else { while (tmpa == NUMERIC_ZERO || tmpa == thousands_sep) - tmpa = *++a; + tmpa = *++a; while (tmpb == NUMERIC_ZERO || tmpb == thousands_sep) - tmpb = *++b; + tmpb = *++b; while (tmpa == tmpb && ISDIGIT (tmpa)) - { - do - tmpa = *++a; - while (tmpa == thousands_sep); - do - tmpb = *++b; - while (tmpb == thousands_sep); - } + { + do + tmpa = *++a; + while (tmpa == thousands_sep); + do + tmpb = *++b; + while (tmpb == thousands_sep); + } if ((tmpa == decimal_point && !ISDIGIT (tmpb)) - || (tmpb == decimal_point && !ISDIGIT (tmpa))) - return fraccompare (a, b, decimal_point); + || (tmpb == decimal_point && !ISDIGIT (tmpa))) + return fraccompare (a, b, decimal_point); tmp = tmpa - tmpb; for (log_a = 0; ISDIGIT (tmpa); ++log_a) - do - tmpa = *++a; - while (tmpa == thousands_sep); + do + tmpa = *++a; + while (tmpa == thousands_sep); for (log_b = 0; ISDIGIT (tmpb); ++log_b) - do - tmpb = *++b; - while (tmpb == thousands_sep); + do + tmpb = *++b; + while (tmpb == thousands_sep); if (log_a != log_b) - return log_a < log_b ? -1 : 1; + return log_a < log_b ? -1 : 1; if (!log_a) - return 0; + return 0; return tmp; } |