text
stringlengths
0
2.2M
static const uint64_t secret[] = { 0xa0761d6478bd642full,
0xe7037ed1a0b428dbull,
0x8ebc6af09c88c6e3ull,
0x589965cc75374cc3ull };
seed ^= secret[0];
uint64_t a, b;
if (U_LIKELY(len <= 16)) {
if (U_LIKELY(len >= 4)) {
const size_t subLen = (len >> 3) << 2;
a = (_wyr4(p) << 32) | _wyr4(p + subLen);
b = (_wyr4(p + len - 4) << 32) | _wyr4(p + len - 4 - subLen);
}
else if (U_LIKELY(len > 0)) {
a = _wyr3(p, len);
b = 0;
}
else {
U_UNLIKELY_HINT;
a = b = 0;
}
}
else {
U_UNLIKELY_HINT;
const uint8_t *end = p + len;
if (U_UNLIKELY(end - p > 48)) {
U_UNLIKELY_HINT;
uint64_t see1 = seed, see2 = seed;
do {
seed = _wymix(_wyr8(p) ^ secret[1], _wyr8(p + 8) ^ seed);
see1 = _wymix(_wyr8(p + 16) ^ secret[2], _wyr8(p + 24) ^ see1);
see2 = _wymix(_wyr8(p + 32) ^ secret[3], _wyr8(p + 40) ^ see2);
p += 48;
} while (U_LIKELY(end - p > 48));
seed ^= see1 ^ see2;
}
while (U_UNLIKELY(end - p > 16)) {
U_UNLIKELY_HINT;
seed = _wymix(_wyr8(p) ^ secret[1], _wyr8(p + 8) ^ seed);
p += 16;
}
a = _wyr8(end - 16);
b = _wyr8(end - 8);
}
return _wymix(secret[1] ^ len, _wymix(a ^ secret[1], b ^ seed));
}
namespace BloombergLP {
namespace bslh {
// MANIPULATORS
void WyHashAlgorithm::operator()(const void *data, size_t numBytes)
{
BSLS_ASSERT(0 != data || 0 == numBytes);
d_data ^= wyhash(static_cast<const uint8_t *>(data), numBytes, d_data);
}
} // close package namespace
} // close enterprise namespace
// ----------------------------------------------------------------------------
// Copyright 2021 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------
// balxml_typesparserutil.t.cpp -*-C++-*-
#include <balxml_typesparserutil.h>
// ----------------------------------------------------------------------------
// NOTICE
//
// This component is not up to date with current BDE coding standards, and
// should not be used as an example for new development.
// ----------------------------------------------------------------------------