Skip to content

Commit 60c4db7

Browse files
committed
Reflect feedbacks
1 parent 187fc5d commit 60c4db7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

common/src/hash.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,18 @@ pub fn lcg_urandom(mut x: u32, buf: &mut [u8]) {
179179
}
180180
}
181181

182+
#[inline]
182183
pub fn hash_object_id_raw(p: usize) -> PyHash {
183184
// TODO: Use commented logic when below issue resolved.
184185
// Ref: https://github.com/RustPython/RustPython/pull/3951#issuecomment-1193108966
185186

186-
// let mut y = p;
187-
// /* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid
188-
// excessive hash collisions for dicts and sets */
189-
// y = (y >> 4) | (y << (8 * std::mem::size_of::<usize>() - 4));
190-
// y as PyHash
187+
/* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid
188+
excessive hash collisions for dicts and sets */
189+
// p.rotate_right(4) as PyHash
191190
p as PyHash
192191
}
193192

193+
#[inline]
194194
pub fn hash_object_id(p: usize) -> PyHash {
195195
fix_sentinel(hash_object_id_raw(p))
196196
}

0 commit comments

Comments
 (0)