Skip to content

Comments

Add const functions for hashing#16

Open
sffc wants to merge 4 commits intocbreeden:masterfrom
sffc:const
Open

Add const functions for hashing#16
sffc wants to merge 4 commits intocbreeden:masterfrom
sffc:const

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