Skip to content

Commit

Permalink
Rollup merge of #129555 - RalfJung:const_float_bits_conv, r=dtolnay
Browse files Browse the repository at this point in the history
stabilize const_float_bits_conv

This stabilizes `const_float_bits_conv`, and thus fixes rust-lang/rust#72447. With rust-lang/rust#128596 having landed, this is entirely a libs-only question now.

```rust
impl f32 {
    pub const fn to_bits(self) -> u32;
    pub const fn from_bits(v: u32) -> Self;
    pub const fn to_be_bytes(self) -> [u8; 4];
    pub const fn to_le_bytes(self) -> [u8; 4]
    pub const fn to_ne_bytes(self) -> [u8; 4];
    pub const fn from_be_bytes(bytes: [u8; 4]) -> Self;
    pub const fn from_le_bytes(bytes: [u8; 4]) -> Self;
    pub const fn from_ne_bytes(bytes: [u8; 4]) -> Self;
}

impl f64 {
    pub const fn to_bits(self) -> u64;
    pub const fn from_bits(v: u64) -> Self;
    pub const fn to_be_bytes(self) -> [u8; 8];
    pub const fn to_le_bytes(self) -> [u8; 8]
    pub const fn to_ne_bytes(self) -> [u8; 8];
    pub const fn from_be_bytes(bytes: [u8; 8]) -> Self;
    pub const fn from_le_bytes(bytes: [u8; 8]) -> Self;
    pub const fn from_ne_bytes(bytes: [u8; 8]) -> Self;
}
````

Cc `@rust-lang/wg-const-eval` `@rust-lang/libs-api`
  • Loading branch information
matthiaskrgr authored Sep 7, 2024
2 parents a4dbd94 + 18b3eb4 commit 67702c4
Showing 0 changed files with 0 additions and 0 deletions.

0 comments on commit 67702c4

Please sign in to comment.