Merge branch 'release-5.1'
This commit is contained in:
commit
de1551c20d
|
@ -21,16 +21,16 @@
|
||||||
TARGETS += packages
|
TARGETS += packages
|
||||||
CLEAN_TARGETS += packages_clean
|
CLEAN_TARGETS += packages_clean
|
||||||
|
|
||||||
PACKAGE_BINARIES = fdbcli fdbserver fdbbackup fdbmonitor fdbrestore fdbblob fdbdr dr_agent backup_agent
|
PACKAGE_BINARIES = fdbcli fdbserver fdbbackup fdbmonitor fdbrestore fdbdr dr_agent backup_agent
|
||||||
PACKAGE_CONTENTS := $(addprefix bin/, $(PACKAGE_BINARIES)) $(addprefix bin/, $(addsuffix .debug, $(PACKAGE_BINARIES))) lib/libfdb_c.$(DLEXT) bindings/python/fdb/fdboptions.py bindings/c/foundationdb/fdb_c_options.g.h
|
PACKAGE_CONTENTS := $(addprefix bin/, $(PACKAGE_BINARIES)) $(addprefix bin/, $(addsuffix .debug, $(PACKAGE_BINARIES))) lib/libfdb_c.$(DLEXT) bindings/python/fdb/fdboptions.py bindings/c/foundationdb/fdb_c_options.g.h
|
||||||
|
|
||||||
packages: TGZ FDBSERVERAPI
|
packages: TGZ FDBSERVERAPI
|
||||||
|
|
||||||
TGZ: $(PACKAGE_CONTENTS) versions.target
|
TGZ: $(PACKAGE_CONTENTS) versions.target lib/libfdb_java.so
|
||||||
@echo "Archiving tgz"
|
@echo "Archiving tgz"
|
||||||
@mkdir -p packages
|
@mkdir -p packages
|
||||||
@rm -f packages/FoundationDB-$(PLATFORM)-*.tar.gz
|
@rm -f packages/FoundationDB-$(PLATFORM)-*.tar.gz
|
||||||
@bash -c "tar -czf packages/FoundationDB-$(PLATFORM)-$(VERSION)-$(PKGRELEASE).tar.gz bin/{fdbmonitor{,.debug},fdbcli{,.debug},fdbserver{,.debug},fdbbackup{,.debug},fdbblob{,.debug},fdbdr{,.debug},fdbrestore{,.debug},dr_agent{,.debug},coverage.{fdbclient,fdbserver,fdbrpc,flow}.xml} lib/libfdb_c.$(DLEXT){,-debug} lib/libfdb_java.$(DLEXT)* bindings/python/fdb/*.py bindings/c/*.h"
|
@bash -c "tar -czf packages/FoundationDB-$(PLATFORM)-$(VERSION)-$(PKGRELEASE).tar.gz bin/{fdbmonitor{,.debug},fdbcli{,.debug},fdbserver{,.debug},fdbbackup{,.debug},fdbdr{,.debug},fdbrestore{,.debug},dr_agent{,.debug},coverage.{fdbclient,fdbserver,fdbrpc,flow}.xml} lib/libfdb_c.$(DLEXT){,-debug} lib/libfdb_java.$(DLEXT)* bindings/python/fdb/*.py bindings/c/*.h"
|
||||||
|
|
||||||
packages_clean:
|
packages_clean:
|
||||||
@echo "Cleaning packages"
|
@echo "Cleaning packages"
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* cdecode.c
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cdecoder.c - c source to a base64 decoding algorithm implementation
|
cdecoder.c - c source to a base64 decoding algorithm implementation
|
||||||
|
|
||||||
|
@ -105,4 +85,3 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex
|
||||||
/* control should not reach here */
|
/* control should not reach here */
|
||||||
return plainchar - plaintext_out;
|
return plainchar - plaintext_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* cdecode.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cdecode.h - c header for a base64 decoding algorithm
|
cdecode.h - c header for a base64 decoding algorithm
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* cencode.c
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cencoder.c - c source to a base64 encoding algorithm implementation
|
cencoder.c - c source to a base64 encoding algorithm implementation
|
||||||
|
|
||||||
|
@ -126,4 +106,3 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
|
||||||
|
|
||||||
return codechar - code_out;
|
return codechar - code_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* cencode.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cencode.h - c header for a base64 encoding algorithm
|
cencode.h - c header for a base64 encoding algorithm
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* decode.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// :mode=c++:
|
// :mode=c++:
|
||||||
/*
|
/*
|
||||||
decode.h - c++ wrapper for a base64 decoding algorithm
|
decode.h - c++ wrapper for a base64 decoding algorithm
|
||||||
|
@ -87,4 +67,3 @@ namespace base64
|
||||||
|
|
||||||
|
|
||||||
#endif // BASE64_DECODE_H
|
#endif // BASE64_DECODE_H
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* encode.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// :mode=c++:
|
// :mode=c++:
|
||||||
/*
|
/*
|
||||||
encode.h - c++ wrapper for a base64 encoding algorithm
|
encode.h - c++ wrapper for a base64 encoding algorithm
|
||||||
|
@ -106,4 +86,3 @@ namespace base64
|
||||||
} // namespace base64
|
} // namespace base64
|
||||||
|
|
||||||
#endif // BASE64_ENCODE_H
|
#endif // BASE64_ENCODE_H
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* SHA1.cpp
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
SHA-1 in C++
|
SHA-1 in C++
|
||||||
|
@ -281,4 +261,4 @@ std::string SHA1::from_string(const std::string &string)
|
||||||
SHA1 checksum;
|
SHA1 checksum;
|
||||||
checksum.update(string);
|
checksum.update(string);
|
||||||
return checksum.final();
|
return checksum.final();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* SHA1.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
SHA-1 in C++
|
SHA-1 in C++
|
||||||
|
@ -67,4 +47,3 @@ private:
|
||||||
static void buffer_to_block(const std::string &buffer, uint32 block[BLOCK_BYTES]);
|
static void buffer_to_block(const std::string &buffer, uint32 block[BLOCK_BYTES]);
|
||||||
static void read(std::istream &is, std::string &s, int max);
|
static void read(std::istream &is, std::string &s, int max);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* crc32.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* crc32.h -- tables for rapid CRC calculation
|
/* crc32.h -- tables for rapid CRC calculation
|
||||||
* Generated automatically by crc32.c
|
* Generated automatically by crc32.c
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* inffixed.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* inffixed.h -- table for decoding fixed codes
|
/* inffixed.h -- table for decoding fixed codes
|
||||||
* Generated automatically by makefixed().
|
* Generated automatically by makefixed().
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* trees.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* header created automatically with -DGEN_TREES_H */
|
/* header created automatically with -DGEN_TREES_H */
|
||||||
|
|
||||||
local const ct_data static_ltree[L_CODES+2] = {
|
local const ct_data static_ltree[L_CODES+2] = {
|
||||||
|
@ -145,4 +125,3 @@ local const int base_dist[D_CODES] = {
|
||||||
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
|
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
|
||||||
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
|
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
62
flow/Hash3.c
62
flow/Hash3.c
|
@ -1,30 +1,10 @@
|
||||||
/*
|
|
||||||
* Hash3.c
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
lookup3.c, by Bob Jenkins, May 2006, Public Domain.
|
lookup3.c, by Bob Jenkins, May 2006, Public Domain.
|
||||||
|
|
||||||
These are functions for producing 32-bit hashes for hash table lookup.
|
These are functions for producing 32-bit hashes for hash table lookup.
|
||||||
hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
|
hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
|
||||||
are externally useful functions. Routines to test the hash are included
|
are externally useful functions. Routines to test the hash are included
|
||||||
if SELF_TEST is defined. You can use this free for any purpose. It's in
|
if SELF_TEST is defined. You can use this free for any purpose. It's in
|
||||||
the public domain. It has no warranty.
|
the public domain. It has no warranty.
|
||||||
|
|
||||||
|
@ -32,7 +12,7 @@ You probably want to use hashlittle(). hashlittle() and hashbig()
|
||||||
hash byte arrays. hashlittle() is is faster than hashbig() on
|
hash byte arrays. hashlittle() is is faster than hashbig() on
|
||||||
little-endian machines. Intel and AMD are little-endian machines.
|
little-endian machines. Intel and AMD are little-endian machines.
|
||||||
On second thought, you probably want hashlittle2(), which is identical to
|
On second thought, you probably want hashlittle2(), which is identical to
|
||||||
hashlittle() except it returns two 32-bit hashes for the price of one.
|
hashlittle() except it returns two 32-bit hashes for the price of one.
|
||||||
You could implement hashbig2() if you wanted but I haven't bothered here.
|
You could implement hashbig2() if you wanted but I haven't bothered here.
|
||||||
|
|
||||||
If you want to find a hash of, say, exactly 7 integers, do
|
If you want to find a hash of, say, exactly 7 integers, do
|
||||||
|
@ -45,9 +25,9 @@ If you want to find a hash of, say, exactly 7 integers, do
|
||||||
then use c as the hash value. If you have a variable length array of
|
then use c as the hash value. If you have a variable length array of
|
||||||
4-byte integers to hash, use hashword(). If you have a byte array (like
|
4-byte integers to hash, use hashword(). If you have a byte array (like
|
||||||
a character string), use hashlittle(). If you have several byte arrays, or
|
a character string), use hashlittle(). If you have several byte arrays, or
|
||||||
a mix of things, see the comments above hashlittle().
|
a mix of things, see the comments above hashlittle().
|
||||||
|
|
||||||
Why is this so big? I read 12 bytes at a time into 3 4-byte integers,
|
Why is this so big? I read 12 bytes at a time into 3 4-byte integers,
|
||||||
then mix those integers. This is fast (you can do a lot more thorough
|
then mix those integers. This is fast (you can do a lot more thorough
|
||||||
mixing with 12*3 instructions on 3 integers than you can with 3 instructions
|
mixing with 12*3 instructions on 3 integers than you can with 3 instructions
|
||||||
on 1 byte), but shoehorning those bytes into integers efficiently is messy.
|
on 1 byte), but shoehorning those bytes into integers efficiently is messy.
|
||||||
|
@ -111,7 +91,7 @@ This was tested for:
|
||||||
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
|
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
|
||||||
is commonly produced by subtraction) look like a single 1-bit
|
is commonly produced by subtraction) look like a single 1-bit
|
||||||
difference.
|
difference.
|
||||||
* the base values were pseudorandom, all zero but one bit set, or
|
* the base values were pseudorandom, all zero but one bit set, or
|
||||||
all zero plus a counter that starts at zero.
|
all zero plus a counter that starts at zero.
|
||||||
|
|
||||||
Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
|
Some k values for my "a-=c; a^=rot(c,k); c+=b;" arrangement that
|
||||||
|
@ -121,7 +101,7 @@ satisfy this are
|
||||||
14 9 3 7 17 3
|
14 9 3 7 17 3
|
||||||
Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
|
Well, "9 15 3 18 27 15" didn't quite get 32 bits diffing
|
||||||
for "differ" defined as + with a one-bit base and a two-bit delta. I
|
for "differ" defined as + with a one-bit base and a two-bit delta. I
|
||||||
used http://burtleburtle.net/bob/hash/avalanche.html to choose
|
used http://burtleburtle.net/bob/hash/avalanche.html to choose
|
||||||
the operations, constants, and arrangements of the variables.
|
the operations, constants, and arrangements of the variables.
|
||||||
|
|
||||||
This does not achieve avalanche. There are input bits of (a,b,c)
|
This does not achieve avalanche. There are input bits of (a,b,c)
|
||||||
|
@ -160,7 +140,7 @@ produce values of c that look totally different. This was tested for
|
||||||
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
|
the output delta to a Gray code (a^(a>>1)) so a string of 1's (as
|
||||||
is commonly produced by subtraction) look like a single 1-bit
|
is commonly produced by subtraction) look like a single 1-bit
|
||||||
difference.
|
difference.
|
||||||
* the base values were pseudorandom, all zero but one bit set, or
|
* the base values were pseudorandom, all zero but one bit set, or
|
||||||
all zero plus a counter that starts at zero.
|
all zero plus a counter that starts at zero.
|
||||||
|
|
||||||
These constants passed:
|
These constants passed:
|
||||||
|
@ -219,7 +199,7 @@ uint32_t initval) /* the previous hash, or an arbitrary value */
|
||||||
|
|
||||||
/*------------------------------------------- handle the last 3 uint32_t's */
|
/*------------------------------------------- handle the last 3 uint32_t's */
|
||||||
switch(length) /* all the case statements fall through */
|
switch(length) /* all the case statements fall through */
|
||||||
{
|
{
|
||||||
case 3 : c+=k[2];
|
case 3 : c+=k[2];
|
||||||
case 2 : b+=k[1];
|
case 2 : b+=k[1];
|
||||||
case 1 : a+=k[0];
|
case 1 : a+=k[0];
|
||||||
|
@ -236,7 +216,7 @@ uint32_t initval) /* the previous hash, or an arbitrary value */
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
hashword2() -- same as hashword(), but take two seeds and return two
|
hashword2() -- same as hashword(), but take two seeds and return two
|
||||||
32-bit values. pc and pb must both be nonnull, and *pc and *pb must
|
32-bit values. pc and pb must both be nonnull, and *pc and *pb must
|
||||||
both be initialized with seeds. If you pass in (*pb)==0, the output
|
both be initialized with seeds. If you pass in (*pb)==0, the output
|
||||||
(*pc) will be the same as the return value from hashword().
|
(*pc) will be the same as the return value from hashword().
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -265,7 +245,7 @@ uint32_t *pb) /* IN: more seed OUT: secondary hash value */
|
||||||
|
|
||||||
/*------------------------------------------- handle the last 3 uint32_t's */
|
/*------------------------------------------- handle the last 3 uint32_t's */
|
||||||
switch(length) /* all the case statements fall through */
|
switch(length) /* all the case statements fall through */
|
||||||
{
|
{
|
||||||
case 3 : c+=k[2];
|
case 3 : c+=k[2];
|
||||||
case 2 : b+=k[1];
|
case 2 : b+=k[1];
|
||||||
case 1 : a+=k[0];
|
case 1 : a+=k[0];
|
||||||
|
@ -332,7 +312,7 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------- handle the last (probably partial) block */
|
/*----------------------------- handle the last (probably partial) block */
|
||||||
/*
|
/*
|
||||||
* "k[2]&0xffffff" actually reads beyond the end of the string, but
|
* "k[2]&0xffffff" actually reads beyond the end of the string, but
|
||||||
* then masks off the part it's not allowed to read. Because the
|
* then masks off the part it's not allowed to read. Because the
|
||||||
* string is aligned, the masked-off tail is in the same word as the
|
* string is aligned, the masked-off tail is in the same word as the
|
||||||
|
@ -487,7 +467,7 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
|
||||||
* the key. *pc is better mixed than *pb, so use *pc first. If you want
|
* the key. *pc is better mixed than *pb, so use *pc first. If you want
|
||||||
* a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)".
|
* a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)".
|
||||||
*/
|
*/
|
||||||
void hashlittle2(
|
void hashlittle2(
|
||||||
const void *key, /* the key to hash */
|
const void *key, /* the key to hash */
|
||||||
size_t length, /* length of the key */
|
size_t length, /* length of the key */
|
||||||
uint32_t *pc, /* IN: primary initval, OUT: primary hash */
|
uint32_t *pc, /* IN: primary initval, OUT: primary hash */
|
||||||
|
@ -519,7 +499,7 @@ void hashlittle2(
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------- handle the last (probably partial) block */
|
/*----------------------------- handle the last (probably partial) block */
|
||||||
/*
|
/*
|
||||||
* "k[2]&0xffffff" actually reads beyond the end of the string, but
|
* "k[2]&0xffffff" actually reads beyond the end of the string, but
|
||||||
* then masks off the part it's not allowed to read. Because the
|
* then masks off the part it's not allowed to read. Because the
|
||||||
* string is aligned, the masked-off tail is in the same word as the
|
* string is aligned, the masked-off tail is in the same word as the
|
||||||
|
@ -669,7 +649,7 @@ void hashlittle2(
|
||||||
* hashbig():
|
* hashbig():
|
||||||
* This is the same as hashword() on big-endian machines. It is different
|
* This is the same as hashword() on big-endian machines. It is different
|
||||||
* from hashlittle() on all machines. hashbig() takes advantage of
|
* from hashlittle() on all machines. hashbig() takes advantage of
|
||||||
* big-endian byte ordering.
|
* big-endian byte ordering.
|
||||||
*/
|
*/
|
||||||
uint32_t hashbig( const void *key, size_t length, uint32_t initval)
|
uint32_t hashbig( const void *key, size_t length, uint32_t initval)
|
||||||
{
|
{
|
||||||
|
@ -698,7 +678,7 @@ uint32_t hashbig( const void *key, size_t length, uint32_t initval)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------- handle the last (probably partial) block */
|
/*----------------------------- handle the last (probably partial) block */
|
||||||
/*
|
/*
|
||||||
* "k[2]<<8" actually reads beyond the end of the string, but
|
* "k[2]<<8" actually reads beyond the end of the string, but
|
||||||
* then shifts out the part it's not allowed to read. Because the
|
* then shifts out the part it's not allowed to read. Because the
|
||||||
* string is aligned, the illegal read is in the same word as the
|
* string is aligned, the illegal read is in the same word as the
|
||||||
|
@ -808,7 +788,7 @@ void driver1()
|
||||||
|
|
||||||
time(&a);
|
time(&a);
|
||||||
for (i=0; i<256; ++i) buf[i] = 'x';
|
for (i=0; i<256; ++i) buf[i] = 'x';
|
||||||
for (i=0; i<1; ++i)
|
for (i=0; i<1; ++i)
|
||||||
{
|
{
|
||||||
h = hashlittle(&buf[0],1,h);
|
h = hashlittle(&buf[0],1,h);
|
||||||
}
|
}
|
||||||
|
@ -844,7 +824,7 @@ void driver2()
|
||||||
|
|
||||||
/*---- check that every output bit is affected by that input bit */
|
/*---- check that every output bit is affected by that input bit */
|
||||||
for (k=0; k<MAXPAIR; k+=2)
|
for (k=0; k<MAXPAIR; k+=2)
|
||||||
{
|
{
|
||||||
uint32_t finished=1;
|
uint32_t finished=1;
|
||||||
/* keys have one bit different */
|
/* keys have one bit different */
|
||||||
for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8_t)0;}
|
for (l=0; l<hlen+1; ++l) {a[l] = b[l] = (uint8_t)0;}
|
||||||
|
@ -869,7 +849,7 @@ void driver2()
|
||||||
if (finished) break;
|
if (finished) break;
|
||||||
}
|
}
|
||||||
if (k>z) z=k;
|
if (k>z) z=k;
|
||||||
if (k==MAXPAIR)
|
if (k==MAXPAIR)
|
||||||
{
|
{
|
||||||
printf("Some bit didn't change: ");
|
printf("Some bit didn't change: ");
|
||||||
printf("%.8x %.8x %.8x %.8x %.8x %.8x ",
|
printf("%.8x %.8x %.8x %.8x %.8x %.8x ",
|
||||||
|
@ -955,7 +935,7 @@ void driver3()
|
||||||
i=47, j=0;
|
i=47, j=0;
|
||||||
hashword2(&len, 1, &i, &j);
|
hashword2(&len, 1, &i, &j);
|
||||||
if (hashword(&len, 1, 47) != i)
|
if (hashword(&len, 1, 47) != i)
|
||||||
printf("hashword2 and hashword mismatch %x %x\n",
|
printf("hashword2 and hashword mismatch %x %x\n",
|
||||||
i, hashword(&len, 1, 47));
|
i, hashword(&len, 1, 47));
|
||||||
|
|
||||||
/* check hashlittle doesn't read before or after the ends of the string */
|
/* check hashlittle doesn't read before or after the ends of the string */
|
||||||
|
@ -972,7 +952,7 @@ void driver3()
|
||||||
*(b-1)=(uint8_t)~0;
|
*(b-1)=(uint8_t)~0;
|
||||||
x = hashlittle(b, len, (uint32_t)1);
|
x = hashlittle(b, len, (uint32_t)1);
|
||||||
y = hashlittle(b, len, (uint32_t)1);
|
y = hashlittle(b, len, (uint32_t)1);
|
||||||
if ((ref != x) || (ref != y))
|
if ((ref != x) || (ref != y))
|
||||||
{
|
{
|
||||||
printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y,
|
printf("alignment error: %.8x %.8x %.8x %d %d\n",ref,x,y,
|
||||||
h, i);
|
h, i);
|
||||||
|
|
24
flow/Hash3.h
24
flow/Hash3.h
|
@ -1,23 +1,3 @@
|
||||||
/*
|
|
||||||
* Hash3.h
|
|
||||||
*
|
|
||||||
* This source file is part of the FoundationDB open source project
|
|
||||||
*
|
|
||||||
* Copyright 2013-2018 Apple Inc. and the FoundationDB project authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FLOW_HASH3_H
|
#ifndef FLOW_HASH3_H
|
||||||
#define FLOW_HASH3_H
|
#define FLOW_HASH3_H
|
||||||
#pragma once
|
#pragma once
|
||||||
|
@ -29,7 +9,7 @@ extern "C" {
|
||||||
|
|
||||||
uint32_t hashlittle( const void *key, size_t length, uint32_t initval);
|
uint32_t hashlittle( const void *key, size_t length, uint32_t initval);
|
||||||
|
|
||||||
void hashlittle2(
|
void hashlittle2(
|
||||||
const void *key, /* the key to hash */
|
const void *key, /* the key to hash */
|
||||||
size_t length, /* length of the key */
|
size_t length, /* length of the key */
|
||||||
uint32_t *pc, /* IN: primary initval, OUT: primary hash */
|
uint32_t *pc, /* IN: primary initval, OUT: primary hash */
|
||||||
|
@ -37,4 +17,4 @@ extern "C" {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue