Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some Hash128 shenaniganeries #8203

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

teh-cmc
Copy link
Member

@teh-cmc teh-cmc commented Nov 22, 2024

Hash128 isn't actually used anywhere, I just randomly stumbled upon it while refactoring some hashing related stuff.

Still a good idea to fix it (or remove it entirely?) before someone's get bitten.

@teh-cmc teh-cmc added 🪳 bug Something isn't working exclude from changelog PRs with this won't show up in CHANGELOG.md labels Nov 22, 2024
Copy link

github-actions bot commented Nov 22, 2024

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link
6930cfb https://rerun.io/viewer/pr/8203

Note: This comment is updated whenever you push a commit.

@@ -91,7 +86,7 @@ impl Hash128 {
impl std::hash::Hash for Hash128 {
#[inline]
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
state.write_u64(self.0[0]);
state.write_u128((self.first64() as u128) << 64 | self.second64() as u128);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, you're only allowed to use write_u64 with nohash_hasher, anything else will result in a runtime error in debug builds.

If the hash128 is good, than any 64 bits of it should also be a good hash

@emilk
Copy link
Member

emilk commented Nov 22, 2024

If Hash128 is unused, remove it - but I don' think this PR makes sense

@teh-cmc
Copy link
Member Author

teh-cmc commented Nov 22, 2024

Let's remove it then.

@teh-cmc teh-cmc requested a review from emilk November 22, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪳 bug Something isn't working exclude from changelog PRs with this won't show up in CHANGELOG.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants