Changeset 8338a81 in mainline for uspace/lib/posix/src/stdlib.c


Ignore:
Timestamp:
2018-06-16T22:20:39Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
379db9ef
Parents:
55092672
Message:

div, ldiv, lldiv should go to libc's stdio.h Add MB_CUR_MAX. Adjust MB_LEN_MAX. Add tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/src/stdlib.c

    r55092672 r8338a81  
    9595{
    9696        return i < 0 ? -i : i;
    97 }
    98 
    99 /**
    100  * Compute the quotient and remainder of an integer division.
    101  *
    102  * @param numer Numerator.
    103  * @param denom Denominator.
    104  * @return Quotient and remainder packed into structure.
    105  */
    106 div_t div(int numer, int denom)
    107 {
    108         return (div_t) { .quot = numer / denom, .rem = numer % denom };
    109 }
    110 
    111 /**
    112  * Compute the quotient and remainder of a long integer division.
    113  *
    114  * @param numer Numerator.
    115  * @param denom Denominator.
    116  * @return Quotient and remainder packed into structure.
    117  */
    118 ldiv_t ldiv(long numer, long denom)
    119 {
    120         return (ldiv_t) { .quot = numer / denom, .rem = numer % denom };
    121 }
    122 
    123 /**
    124  * Compute the quotient and remainder of a long long integer division.
    125  *
    126  * @param numer Numerator.
    127  * @param denom Denominator.
    128  * @return Quotient and remainder packed into structure.
    129  */
    130 lldiv_t lldiv(long long numer, long long denom)
    131 {
    132         return (lldiv_t) { .quot = numer / denom, .rem = numer % denom };
    13397}
    13498
Note: See TracChangeset for help on using the changeset viewer.