mirror of
https://github.com/dlang/phobos.git
synced 2025-04-29 06:30:28 +03:00
Adds assert messages
This commit is contained in:
parent
ad540ccaa2
commit
ef71418e73
1 changed files with 4 additions and 2 deletions
|
@ -1218,7 +1218,8 @@ private:
|
|||
import core.checkedint : mulu;
|
||||
bool overflow;
|
||||
const rc = mulu(r, c, overflow);
|
||||
if (overflow) assert(0);
|
||||
assert(!overflow, "Overflow during multiplication to determine number "
|
||||
~ " of matrix elements");
|
||||
rows = r;
|
||||
cols = c;
|
||||
if (_matrix.length < rc)
|
||||
|
@ -1226,7 +1227,8 @@ private:
|
|||
import core.exception : onOutOfMemoryError;
|
||||
import core.stdc.stdlib : realloc;
|
||||
const nbytes = mulu(rc, _matrix[0].sizeof, overflow);
|
||||
if (overflow) assert(0);
|
||||
assert(!overflow, "Overflow during multiplication to determine "
|
||||
~ " number of bytes of matrix");
|
||||
auto m = cast(CostType *) realloc(_matrix.ptr, nbytes);
|
||||
if (!m)
|
||||
onOutOfMemoryError();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue