Return the difference between the specified minuend and the specified subtrahend (typically minuend ‐ subtrahend) where minuend and subtrahend are both "circular values", meaning they are part of a non‐euclidean number line where the value wrap around to 0 at the specified modulo. The difference between two circular values is the minimum of either the number of increments or the number of decrements to subtrahend that results in minuend (i.e., the minimum "distance" between the points on the number circle), where increments are a positive difference, and decrements are a negative difference. If the number of increments and number of decrements between minuend and subtrahend are equal, minuend ‐ subtrahend is returned. For example, for a hypothetical compass, [0, 360):] ` circularDifference( 0, 359, 360) == 1 circularDifference( 359, 0, 360) == ‐1 circularDifference( 180, 0, 360) == 180 circularDifference( 0, 180, 360) == ‐180 ` The behavior is undefined unless minuend < modulo, subtrahend < modulo, and modulo <= INT_MAX + 1.

Synopsis

Declared in <bdlcc_fixedqueueindexmanager.h>

static
int
circularDifference(
    unsigned int minuend,
    unsigned int subtrahend,
    unsigned int modulo);

Created with MrDocs