Changeset e3272101 in mainline for uspace/lib/c/generic/cap.c


Ignore:
Timestamp:
2019-02-11T14:08:52Z (5 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
d5a89a3
Parents:
aa57bf7
Message:

make ilog10_u64() return an errno_t

The function ilog10_u64() used to return 0
for the value 0. Which is not correct. Either
NaN or -Infinity are correct, but not 0, since
it would be ambiguous with log(1). To ensure this
case the function ilog10_u64() has been changed
to return a errno_t indicating a failure.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/cap.c

    raa57bf7 re3272101  
    160160
    161161        /* Round the number so that we have at most @c scap_max_sdig significant digits */
    162         sdig = 1 + ilog10_u64(cap->m); /* number of significant digits */
     162        rc = ilog10_u64(cap->m, &sdig); /* number of significant digits */
     163        sdig += 1;
     164        assert(rc == EOK);
    163165        if (sdig > scap_max_sdig) {
    164166                /* Number of digits to remove */
Note: See TracChangeset for help on using the changeset viewer.