]> git.lizzy.rs Git - rust.git/commit
Add non-panicking abs() functions to all signed integer types.
authorJethro Beekman <jethro@jbeekman.nl>
Tue, 26 Jul 2016 23:31:39 +0000 (16:31 -0700)
committerJethro Beekman <jethro@jbeekman.nl>
Thu, 28 Jul 2016 16:05:43 +0000 (09:05 -0700)
commitcdc6afed389ecdcea0955eadae59ea6b008a58fe
treec5474f47c318d42501aa2c57c437d49a5675598d
parentcec262e55a92ad15196c4ea6d490fb6ef6bccab4
Add non-panicking abs() functions to all signed integer types.

Currently, calling abs() on one of the signed integer types might panic (in
debug mode at least) because the absolute value of the largest negative value
can not be represented in that signed type. Unlike all other integer
operations, there is currently not a non-panicking version on this function.
This seems to just be an oversight in the design, therefore just adding it now.
src/libcore/num/mod.rs