This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of NAD status.

583. div() for unsigned integral types

Section: 28.7 [c.math] Status: NAD Submitter: Beman Dawes Opened: 2006-06-15 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [c.math].

View all issues with NAD status.

Discussion:

There is no div() function for unsigned integer types.

There are several possible resolutions. The simplest one is noted below. Other possibilities include a templated solution.

Proposed resolution:

Add to 26.7 [lib.c.math] paragraph 8:

struct udiv_t div(unsigned, unsigned);
struct uldiv_t div(unsigned long, unsigned long);
struct ulldiv_t div(unsigned long long, unsigned long long);

Rationale:

Toronto: C99 does not have these unsigned versions because the signed version exist just to define the implementation-defined behavior of signed integer division. Unsigned integer division has no implementation-defined behavior and thus does not need this treatment.