Skip to content

Commit 05992d7

Browse files
otfacebook-github-bot
authored andcommitted
Remove deprecated Range::hash()
Summary: This function is deprecated and it doesn't appear to be used anywhere. Reviewed By: Orvid Differential Revision: D76537617 fbshipit-source-id: d3b01bf86e3c8bbbfd4cda13fcf947ca55fe6bd7
1 parent c959738 commit 05992d7

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

third-party/folly/src/folly/Range.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -793,36 +793,6 @@ class Range {
793793
return b_[i];
794794
}
795795

796-
// Do NOT use this function, which was left behind for backwards
797-
// compatibility. Use SpookyHashV2 instead -- it is faster, and produces
798-
// a 64-bit hash, which means dramatically fewer collisions in large maps.
799-
// (The above advice does not apply if you are targeting a 32-bit system.)
800-
//
801-
// Works only for Range<const char*> and Range<char*>
802-
//
803-
//
804-
// ** WANT TO GET RID OF THIS LINT? **
805-
//
806-
// A) Use a better hash function (*cough*folly::Hash*cough*), but
807-
// only if you don't serialize data in a format that depends on
808-
// this formula (ie the writer and reader assume this exact hash
809-
// function is used).
810-
//
811-
// B) If you have to use this exact function then make your own hasher
812-
// object and copy the body over (see thrift example: D3972362).
813-
// https://github.com/facebook/fbthrift/commit/f8ed502e24ab4a32a9d5f266580
814-
[[deprecated(
815-
"Replace with folly::Hash if the hash is not serialized")]] uint32_t
816-
hash() const {
817-
// Taken from fbi/nstring.h:
818-
// Quick and dirty bernstein hash...fine for short ascii strings
819-
uint32_t hash = 5381;
820-
for (size_t ix = 0; ix < size(); ix++) {
821-
hash = ((hash << 5) + hash) + b_[ix];
822-
}
823-
return hash;
824-
}
825-
826796
void advance(size_type n) {
827797
if (FOLLY_UNLIKELY(n > size())) {
828798
throw_exception<std::out_of_range>("index out of range");

0 commit comments

Comments
 (0)