Skip to content

Tracking Issue for hint::select_unpredictable #133962

Open
@joboet

Description

@joboet

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

Unresolved Questions

  • This should be const, right?

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: 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.disposition-mergeThis 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.to-announceAnnounce this issue on triage meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions