Skip to content

Commit

Permalink
Allow s to mutate in Rust farmhash64 function
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaasuni committed Mar 5, 2024
1 parent 469dd25 commit 6ee5df4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.0
1.5.1
2 changes: 1 addition & 1 deletion c/doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = FarmHash64
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.5.0
PROJECT_NUMBER = 1.5.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def run(self):

setup(
name="farmhash64",
version="1.5.0.0",
version="1.5.1.0",
keywords=("farmhash64"),
description="farmhash64 Bindings for Python",
long_description=read("../README.md"),
Expand Down
2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "farmhash64"
version = "1.5.0"
version = "1.5.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
4 changes: 1 addition & 3 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ fn hash_len_33_to_64(s: &[u8]) -> u64 {
}

// FarmHash64 returns a 64-bit fingerprint hash for a string.
pub fn farmhash64(s: &[u8]) -> u64 {
pub fn farmhash64(mut s: &[u8]) -> u64 {
let slen = s.len();
let seed: u64 = 81;

Expand Down Expand Up @@ -243,8 +243,6 @@ pub fn farmhash64(s: &[u8]) -> u64 {
let last64_idx = end_idx + ((slen - 1) & 63) - 63;
let last64 = &s[last64_idx..];

let mut s = s;

while s.len() > 64 {
x = (rotate64(
x.wrapping_add(y)
Expand Down

0 comments on commit 6ee5df4

Please sign in to comment.