提交 7ba5f166 编写于 作者: H Huon Wilson

Mark the {min,max}_value functions on integers #[inline].

These compile down to `mov $CONSTANT, register; ret`, but the lack of
`#[inline]` meant they have a full `call ...` when used from external
crates.
上级 5c963697
......@@ -113,12 +113,14 @@ unsafe fn bswap8(x: u8) -> u8 { x }
$mul_with_overflow:path) => {
/// Returns the smallest value that can be represented by this integer type.
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn min_value() -> $T {
(-1 as $T) << ($BITS - 1)
}
/// Returns the largest value that can be represented by this integer type.
#[stable(feature = "rust1", since = "1.0.0")]
#[inline]
pub fn max_value() -> $T {
let min = $T::min_value(); !min
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册