diff options
| author | Tyson Nottingham <tgnottingham@gmail.com> | 2020-10-05 00:47:44 -0700 |
|---|---|---|
| committer | Tyson Nottingham <tgnottingham@gmail.com> | 2020-10-05 00:47:44 -0700 |
| commit | 581cc4abf5dd2802914cf4fee832cda2ae7a89a0 (patch) | |
| tree | 4c6152140d87c108a5ce0c58f88c682e8e88e396 /compiler/rustc_data_structures/src | |
| parent | b86161ad9c2ba27d8b2c899a7adead7d4ebd54bd (diff) | |
| download | rust-581cc4abf5dd2802914cf4fee832cda2ae7a89a0.tar.gz rust-581cc4abf5dd2802914cf4fee832cda2ae7a89a0.zip | |
SipHasher128: use specific struct layout
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/sip128.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_data_structures/src/sip128.rs b/compiler/rustc_data_structures/src/sip128.rs index 8b91407acff..5bbc53945ed 100644 --- a/compiler/rustc_data_structures/src/sip128.rs +++ b/compiler/rustc_data_structures/src/sip128.rs @@ -15,7 +15,13 @@ const BUFFER_SIZE_BYTES_SPILL: usize = BUFFER_SIZE_ELEMS_SPILL * ELEM_SIZE; const BUFFER_SPILL_INDEX: usize = BUFFER_SIZE_ELEMS_SPILL - 1; #[derive(Debug, Clone)] +#[repr(C)] pub struct SipHasher128 { + // The access pattern during hashing consists of accesses to `nbuf` and + // `buf` until the buffer is full, followed by accesses to `state` and + // `processed`, and then repetition of that pattern until hashing is done. + // This is the basis for the ordering of fields below. However, in practice + // the cache miss-rate for data access is extremely low regardless of order. nbuf: usize, // how many bytes in buf are valid buf: [MaybeUninit<u64>; BUFFER_SIZE_ELEMS_SPILL], // unprocessed bytes le state: State, // hash State |
