-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto merge of #6722 : alexcrichton/rust/issue-4219-no-merge-hack, r=b…
…rson Changes the int/uint modules to all use macros instead of using the `merge` attribute. It would be nice to have #4375 resolved as well for this, but that can probably come at a later date. Closes #4219.
- Loading branch information
Showing
24 changed files
with
909 additions
and
1,201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
//! Operations and constants for `i16` | ||
use num::BitCount; | ||
use unstable::intrinsics; | ||
|
||
pub use self::generated::*; | ||
|
||
int_module!(i16, 16) | ||
|
||
impl BitCount for i16 { | ||
/// Counts the number of bits set. Wraps LLVM's `ctpop` intrinsic. | ||
#[inline(always)] | ||
fn population_count(&self) -> i16 { unsafe { intrinsics::ctpop16(*self) } } | ||
|
||
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic. | ||
#[inline(always)] | ||
fn leading_zeros(&self) -> i16 { unsafe { intrinsics::ctlz16(*self) } } | ||
|
||
/// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic. | ||
#[inline(always)] | ||
fn trailing_zeros(&self) -> i16 { unsafe { intrinsics::cttz16(*self) } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
//! Operations and constants for `i32` | ||
use num::BitCount; | ||
use unstable::intrinsics; | ||
|
||
pub use self::generated::*; | ||
|
||
int_module!(i32, 32) | ||
|
||
impl BitCount for i32 { | ||
/// Counts the number of bits set. Wraps LLVM's `ctpop` intrinsic. | ||
#[inline(always)] | ||
fn population_count(&self) -> i32 { unsafe { intrinsics::ctpop32(*self) } } | ||
|
||
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic. | ||
#[inline(always)] | ||
fn leading_zeros(&self) -> i32 { unsafe { intrinsics::ctlz32(*self) } } | ||
|
||
/// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic. | ||
#[inline(always)] | ||
fn trailing_zeros(&self) -> i32 { unsafe { intrinsics::cttz32(*self) } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
//! Operations and constants for `i64` | ||
use num::BitCount; | ||
use unstable::intrinsics; | ||
|
||
pub use self::generated::*; | ||
|
||
int_module!(i64, 64) | ||
|
||
impl BitCount for i64 { | ||
/// Counts the number of bits set. Wraps LLVM's `ctpop` intrinsic. | ||
#[inline(always)] | ||
fn population_count(&self) -> i64 { unsafe { intrinsics::ctpop64(*self) } } | ||
|
||
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic. | ||
#[inline(always)] | ||
fn leading_zeros(&self) -> i64 { unsafe { intrinsics::ctlz64(*self) } } | ||
|
||
/// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic. | ||
#[inline(always)] | ||
fn trailing_zeros(&self) -> i64 { unsafe { intrinsics::cttz64(*self) } } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
//! Operations and constants for `i8` | ||
use num::BitCount; | ||
use unstable::intrinsics; | ||
|
||
pub use self::generated::*; | ||
|
||
int_module!(i8, 8) | ||
|
||
impl BitCount for i8 { | ||
/// Counts the number of bits set. Wraps LLVM's `ctpop` intrinsic. | ||
#[inline(always)] | ||
fn population_count(&self) -> i8 { unsafe { intrinsics::ctpop8(*self) } } | ||
|
||
/// Counts the number of leading zeros. Wraps LLVM's `ctlz` intrinsic. | ||
#[inline(always)] | ||
fn leading_zeros(&self) -> i8 { unsafe { intrinsics::ctlz8(*self) } } | ||
|
||
/// Counts the number of trailing zeros. Wraps LLVM's `cttz` intrinsic. | ||
#[inline(always)] | ||
fn trailing_zeros(&self) -> i8 { unsafe { intrinsics::cttz8(*self) } } | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.