about summary refs log tree commit diff
path: root/tests/rustdoc-json/structs/unit.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-22 10:56:14 +0000
committerbors <bors@rust-lang.org>2025-03-22 10:56:14 +0000
commit0ce1369bde8ea61c0286f6e3e35e38fca569a50b (patch)
treec30931345cb79f49c0e4476cf4c2bbbda063a6d4 /tests/rustdoc-json/structs/unit.rs
parentdb687889a5833381b8b02738a1af93a09a97ba16 (diff)
parentd7685f0d0b530f39c318713f90bc4c2ba8832f47 (diff)
downloadrust-0ce1369bde8ea61c0286f6e3e35e38fca569a50b.tar.gz
rust-0ce1369bde8ea61c0286f6e3e35e38fca569a50b.zip
Auto merge of #136974 - m-ou-se:fmt-options-64-bit, r=scottmcm
Reduce FormattingOptions to 64 bits

This is part of https://github.com/rust-lang/rust/issues/99012

This reduces FormattingOptions from 6-7 machine words (384 bits on 64-bit platforms, 224 bits on 32-bit platforms) to just 64 bits (a single register on 64-bit platforms).

Before:

```rust
pub struct FormattingOptions {
    flags: u32, // only 6 bits used
    fill: char,
    align: Option<Alignment>,
    width: Option<usize>,
    precision: Option<usize>,
}
```

After:

```rust
pub struct FormattingOptions {
    /// Bits:
    ///  - 0-20: fill character (21 bits, a full `char`)
    ///  - 21: `+` flag
    ///  - 22: `-` flag
    ///  - 23: `#` flag
    ///  - 24: `0` flag
    ///  - 25: `x?` flag
    ///  - 26: `X?` flag
    ///  - 27: Width flag (if set, the width field below is used)
    ///  - 28: Precision flag (if set, the precision field below is used)
    ///  - 29-30: Alignment (0: Left, 1: Right, 2: Center, 3: Unknown)
    ///  - 31: Always set to 1
    flags: u32,
    /// Width if width flag above is set. Otherwise, always 0.
    width: u16,
    /// Precision if precision flag above is set. Otherwise, always 0.
    precision: u16,
}
```
Diffstat (limited to 'tests/rustdoc-json/structs/unit.rs')
0 files changed, 0 insertions, 0 deletions