adds std:: to stl types (#061)
This commit is contained in:
committed by
Alkis Evlogimenos
parent
27c5d86527
commit
818b583387
@@ -83,9 +83,9 @@ char* CompressFragment(const char* input,
|
||||
// Separate implementation for x86_64, for speed. Uses the fact that
|
||||
// x86_64 is little endian.
|
||||
#if defined(ARCH_K8)
|
||||
static inline pair<size_t, bool> FindMatchLength(const char* s1,
|
||||
const char* s2,
|
||||
const char* s2_limit) {
|
||||
static inline std::pair<size_t, bool> FindMatchLength(const char* s1,
|
||||
const char* s2,
|
||||
const char* s2_limit) {
|
||||
assert(s2_limit >= s2);
|
||||
size_t matched = 0;
|
||||
|
||||
@@ -98,7 +98,8 @@ static inline pair<size_t, bool> FindMatchLength(const char* s1,
|
||||
uint64 a1 = UNALIGNED_LOAD64(s1);
|
||||
uint64 a2 = UNALIGNED_LOAD64(s2);
|
||||
if (a1 != a2) {
|
||||
return pair<size_t, bool>(Bits::FindLSBSetNonZero64(a1 ^ a2) >> 3, true);
|
||||
return std::pair<size_t, bool>(Bits::FindLSBSetNonZero64(a1 ^ a2) >> 3,
|
||||
true);
|
||||
} else {
|
||||
matched = 8;
|
||||
s2 += 8;
|
||||
@@ -118,7 +119,7 @@ static inline pair<size_t, bool> FindMatchLength(const char* s1,
|
||||
int matching_bits = Bits::FindLSBSetNonZero64(x);
|
||||
matched += matching_bits >> 3;
|
||||
assert(matched >= 8);
|
||||
return pair<size_t, bool>(matched, false);
|
||||
return std::pair<size_t, bool>(matched, false);
|
||||
}
|
||||
}
|
||||
while (PREDICT_TRUE(s2 < s2_limit)) {
|
||||
@@ -126,15 +127,15 @@ static inline pair<size_t, bool> FindMatchLength(const char* s1,
|
||||
++s2;
|
||||
++matched;
|
||||
} else {
|
||||
return pair<size_t, bool>(matched, matched < 8);
|
||||
return std::pair<size_t, bool>(matched, matched < 8);
|
||||
}
|
||||
}
|
||||
return pair<size_t, bool>(matched, matched < 8);
|
||||
return std::pair<size_t, bool>(matched, matched < 8);
|
||||
}
|
||||
#else
|
||||
static inline pair<size_t, bool> FindMatchLength(const char* s1,
|
||||
const char* s2,
|
||||
const char* s2_limit) {
|
||||
static inline std::pair<size_t, bool> FindMatchLength(const char* s1,
|
||||
const char* s2,
|
||||
const char* s2_limit) {
|
||||
// Implementation based on the x86-64 version, above.
|
||||
assert(s2_limit >= s2);
|
||||
int matched = 0;
|
||||
@@ -154,7 +155,7 @@ static inline pair<size_t, bool> FindMatchLength(const char* s1,
|
||||
++matched;
|
||||
}
|
||||
}
|
||||
return pair<size_t, bool>(matched, matched < 8);
|
||||
return std::pair<size_t, bool>(matched, matched < 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -433,7 +433,8 @@ char* CompressFragment(const char* input,
|
||||
// We have a 4-byte match at ip, and no need to emit any
|
||||
// "literal bytes" prior to ip.
|
||||
const char* base = ip;
|
||||
pair<size_t, bool> p = FindMatchLength(candidate + 4, ip + 4, ip_end);
|
||||
std::pair<size_t, bool> p =
|
||||
FindMatchLength(candidate + 4, ip + 4, ip_end);
|
||||
size_t matched = 4 + p.first;
|
||||
ip += matched;
|
||||
size_t offset = base - candidate;
|
||||
@@ -1216,7 +1217,7 @@ class SnappyScatteredWriter {
|
||||
// We need random access into the data generated so far. Therefore
|
||||
// we keep track of all of the generated data as an array of blocks.
|
||||
// All of the blocks except the last have length kBlockSize.
|
||||
vector<char*> blocks_;
|
||||
std::vector<char*> blocks_;
|
||||
size_t expected_;
|
||||
|
||||
// Total size of all fully generated blocks so far
|
||||
@@ -1399,7 +1400,7 @@ class SnappySinkAllocator {
|
||||
}
|
||||
|
||||
Sink* dest_;
|
||||
vector<Datablock> blocks_;
|
||||
std::vector<Datablock> blocks_;
|
||||
|
||||
// Note: copying this object is allowed
|
||||
};
|
||||
|
||||
@@ -393,10 +393,10 @@ static void Measure(const char* data,
|
||||
{
|
||||
// Chop the input into blocks
|
||||
int num_blocks = (length + block_size - 1) / block_size;
|
||||
vector<const char*> input(num_blocks);
|
||||
vector<size_t> input_length(num_blocks);
|
||||
vector<string> compressed(num_blocks);
|
||||
vector<string> output(num_blocks);
|
||||
std::vector<const char*> input(num_blocks);
|
||||
std::vector<size_t> input_length(num_blocks);
|
||||
std::vector<string> compressed(num_blocks);
|
||||
std::vector<string> output(num_blocks);
|
||||
for (int b = 0; b < num_blocks; b++) {
|
||||
int input_start = b * block_size;
|
||||
int input_limit = min<int>((b+1)*block_size, length);
|
||||
@@ -1054,7 +1054,8 @@ TEST(Snappy, ZeroOffsetCopyValidation) {
|
||||
namespace {
|
||||
|
||||
int TestFindMatchLength(const char* s1, const char *s2, unsigned length) {
|
||||
pair<size_t, bool> p = snappy::internal::FindMatchLength(s1, s2, s2 + length);
|
||||
std::pair<size_t, bool> p =
|
||||
snappy::internal::FindMatchLength(s1, s2, s2 + length);
|
||||
CHECK_EQ(p.first < 8, p.second);
|
||||
return p.first;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user