|
2 | 2 | //! 64-bit pointers.
|
3 | 3 | //!
|
4 | 4 | //! (Note that `bitpacked` vs `unpacked` here has no relationship to
|
5 |
| -//! `#[repr(packed)]`, it just refers to attempting to use any available |
6 |
| -//! bits in a more clever manner than `rustc`'s default layout algorithm would). |
| 5 | +//! `#[repr(packed)]`, it just refers to attempting to use any available bits in |
| 6 | +//! a more clever manner than `rustc`'s default layout algorithm would). |
7 | 7 | //!
|
8 |
| -//! Conceptually, it stores the same information as the "unpacked" equivalent we |
9 |
| -//! use on other targets: `repr_unpacked::Repr` (see repr_unpacked.rs), however |
10 |
| -//! it packs it into a 64bit non-zero value. |
| 8 | +//! Conceptually, it stores the same data as the "unpacked" equivalent we use on |
| 9 | +//! other targets. Specifically, you can imagine it as an optimized following |
| 10 | +//! data (which is equivalent to what's stored by `repr_unpacked::Repr`, e.g. |
| 11 | +//! `super::ErrorData<Box<Custom>>`): |
| 12 | +//! |
| 13 | +//! ```ignore (exposition-only) |
| 14 | +//! enum ErrorData { |
| 15 | +//! Os(i32), |
| 16 | +//! Simple(ErrorKind), |
| 17 | +//! SimpleMessage(&'static SimpleMessage), |
| 18 | +//! Custom(Box<Custom>), |
| 19 | +//! } |
| 20 | +//! ``` |
| 21 | +//! |
| 22 | +//! However, it packs this data into a 64bit non-zero value. |
11 | 23 | //!
|
12 | 24 | //! This optimization not only allows `io::Error` to occupy a single pointer,
|
13 | 25 | //! but improves `io::Result` as well, especially for situations like
|
14 |
| -//! `Result<()>` (which is now 64 bits) or `Result<u64>` (which i), which are |
15 |
| -//! quite common. |
| 26 | +//! `io::Result<()>` (which is now 64 bits) or `io::Result<u64>` (which is now |
| 27 | +//! 128 bits), which are quite common. |
16 | 28 | //!
|
17 | 29 | //! # Layout
|
18 | 30 | //! Tagged values are 64 bits, with the 2 least significant bits used for the
|
|
0 commit comments