Open
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
Metadata
Metadata
Assignees
Labels
Category: An issue tracking the progress of sth. like the implementation of an RFCRelevant to the library API team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.Announce this issue on triage meeting