-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed as not planned
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-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.
Description
This is an enhancement request. I'd like u32::from_bits, u64::from_bits, and f32::to_bits, f64::to_bits usable in const functions. I think today they can be implemented using const_transmute:
#![feature(const_transmute)]
const fn from_bits(v: u32) -> f32 {
unsafe { std::mem::transmute(v) }
}
const fn to_bits(v: f32) -> u32 {
unsafe { std::mem::transmute(v) }
}
fn main() {}Ryan1729 and raviqqe
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-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.