Function checkedSub

Subtract two signed 64-bit values without overflow.

bool checkedSub(
  long a,
  long b,
  out long result
) pure nothrow @nogc @safe;

Parameters

NameDescription
a Minuend.
b Subtrahend.
result Receives the exact difference when the operation succeeds.

Returns

true when a - b is representable as long; false otherwise.