Skip to content

Rollup of 9 pull requests #38826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a99f70b
Clarify zero-value behavior of `ctlz`/`cttz` intrinsics.
frewsxcv Dec 11, 2016
3caf478
Add test for correct span for type
estebank Dec 25, 2016
0ab7812
Clarify behavior of `VecDeque::insert`.
frewsxcv Dec 23, 2016
a52f257
Fix doc for `escape_debug`
bombless Dec 27, 2016
dfb6ae6
Test for appropriate span on second custom derive
estebank Dec 25, 2016
ca9b07b
Replace uses of `#[unsafe_destructor_blind_to_params]` with `#[may_da…
apasel422 Dec 28, 2016
ae23f03
Doc fix
minaguib Jan 3, 2017
c0efdbf
Document custom derive.
steveklabnik Jan 2, 2017
07e844f
Add more docs for CoerceUnsized and Unsize
Manishearth Jan 4, 2017
5dadffc
Rollup merge of #38310 - frewsxcv:ctlz-cttz, r=pnkfelix
GuillaumeGomez Jan 4, 2017
69888bd
Rollup merge of #38581 - frewsxcv:vecdequeue-insert, r=GuillaumeGomez
GuillaumeGomez Jan 4, 2017
74c6fcc
Rollup merge of #38606 - estebank:test-for-27522, r=petrochenkov
GuillaumeGomez Jan 4, 2017
30c405d
Rollup merge of #38607 - estebank:test-for-36935, r=petrochenkov
GuillaumeGomez Jan 4, 2017
8b05a91
Rollup merge of #38629 - bombless:patch-4, r=petrochenkov
GuillaumeGomez Jan 4, 2017
a282e07
Rollup merge of #38664 - apasel422:may-dangle, r=pnkfelix
GuillaumeGomez Jan 4, 2017
e9926c0
Rollup merge of #38770 - steveklabnik:doc-custom-derive, r=nikomatsakis
GuillaumeGomez Jan 4, 2017
3458490
Rollup merge of #38799 - minaguib:patch-1, r=steveklabnik
GuillaumeGomez Jan 4, 2017
05913bd
Rollup merge of #38816 - Manishearth:coercion-doc, r=GuillaumeGomez
GuillaumeGomez Jan 4, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Clarify zero-value behavior of ctlz/cttz intrinsics.
Fixes #34381.
  • Loading branch information
frewsxcv committed Dec 15, 2016
commit a99f70b1e424595dbdcbad4a415f549a6d6686bc
52 changes: 50 additions & 2 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1156,10 +1156,58 @@ extern "rust-intrinsic" {
/// Returns the number of bits set in an integer type `T`
pub fn ctpop<T>(x: T) -> T;

/// Returns the number of leading bits unset in an integer type `T`
/// Returns the number of leading unset bits (zeroes) in an integer type `T`.
///
/// # Examples
///
/// ```
/// #![feature(core_intrinsics)]
///
/// use std::intrinsics::ctlz;
///
/// let x = 0b0001_1100_u8;
/// let num_leading = unsafe { ctlz(x) };
/// assert_eq!(num_leading, 3);
/// ```
///
/// An `x` with value `0` will return the bit width of `T`.
///
/// ```
/// #![feature(core_intrinsics)]
///
/// use std::intrinsics::ctlz;
///
/// let x = 0u16;
/// let num_leading = unsafe { ctlz(x) };
/// assert_eq!(num_leading, 16);
/// ```
pub fn ctlz<T>(x: T) -> T;

/// Returns the number of trailing bits unset in an integer type `T`
/// Returns the number of trailing unset bits (zeroes) in an integer type `T`.
///
/// # Examples
///
/// ```
/// #![feature(core_intrinsics)]
///
/// use std::intrinsics::cttz;
///
/// let x = 0b0011_1000_u8;
/// let num_trailing = unsafe { cttz(x) };
/// assert_eq!(num_trailing, 3);
/// ```
///
/// An `x` with value `0` will return the bit width of `T`:
///
/// ```
/// #![feature(core_intrinsics)]
///
/// use std::intrinsics::cttz;
///
/// let x = 0u16;
/// let num_trailing = unsafe { cttz(x) };
/// assert_eq!(num_trailing, 16);
/// ```
pub fn cttz<T>(x: T) -> T;

/// Reverses the bytes in an integer type `T`.
Expand Down