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

Add const functions for hashing #16

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add const functions for hashing #16

wants to merge 4 commits into from

Conversation

sffc
Copy link

@sffc sffc commented Jan 13, 2022

This PR adds const functions for generating 32-bit and 64-bit hashes from byte slices. This allows the generation of hashes at compile time.

Builds on #13

lib.rs Outdated
}

/// A const function for when you need a 64-bit hash of a byte array.
pub const fn hash64_bytes(v: &[u8]) -> u32 {
Copy link

Choose a reason for hiding this comment

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

shouldn't this be:

pub const fn hash64_bytes(v: &[u8]) -> u64 {
    write64(0, v)
}

Copy link
Author

Choose a reason for hiding this comment

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

Yes good catch, fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants