-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Description
Feature gate: #![feature(select_unpredictable)]
This is a tracking issue for hint::select_unpredictable
, which selects between two values and hints to the optimizer that it should try to generate branchless code.
Public API
// core::hint
/// Returns either `true_val` or `false_val` depending on the value of
/// `b`, with a hint to the compiler that `condition` is unlikely
/// to be correctly predicted by a CPU’s branch predictor.
pub fn select_unpredictable<T>(b: bool, true_val: T, false_val: T) -> T;
Steps / History
- ACP: ACP: add bool::select libs-team#468
- Implementation: core: implement
bool::select_unpredictable
#133964 - Moved to
core::hint
: Moveselect_unpredictable
to thehint
module #139726 - Fixed drop handling: Fix drop handling in
hint::select_unpredictable
#139977 - Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- This should be
const
, right?
Footnotes
bjoernagerjieyouxu, hanna-kruppe and Luracasmus
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.