projects
/
folly.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix build failure with GCC 5
[folly.git]
/
folly
/
detail
/
RangeSse42.cpp
diff --git
a/folly/detail/RangeSse42.cpp
b/folly/detail/RangeSse42.cpp
index 79dfe74e4d80b56fbeaf883481e81a5cf6a4361d..fc9a759f3cf3be984cc4c35c9a0b38747e2126a6 100644
(file)
--- a/
folly/detail/RangeSse42.cpp
+++ b/
folly/detail/RangeSse42.cpp
@@
-1,5
+1,5
@@
/*
/*
- * Copyright 201
6
Facebook, Inc.
+ * Copyright 201
7
Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-88,9
+88,9
@@
static size_t qfind_first_byte_of_needles16(const StringPieceLite haystack,
// helper method for case where needles.size() <= 16
size_t qfind_first_byte_of_needles16(const StringPieceLite haystack,
const StringPieceLite needles) {
// helper method for case where needles.size() <= 16
size_t qfind_first_byte_of_needles16(const StringPieceLite haystack,
const StringPieceLite needles) {
- DCHECK_GT(haystack.size(), 0);
- DCHECK_GT(needles.size(), 0);
- DCHECK_LE(needles.size(), 16);
+ DCHECK_GT(haystack.size(), 0
u
);
+ DCHECK_GT(needles.size(), 0
u
);
+ DCHECK_LE(needles.size(), 16
u
);
if ((needles.size() <= 2 && haystack.size() >= 256) ||
// must bail if we can't even SSE-load a single segment of haystack
(haystack.size() < 16 &&
if ((needles.size() <= 2 && haystack.size() >= 256) ||
// must bail if we can't even SSE-load a single segment of haystack
(haystack.size() < 16 &&
@@
-105,10
+105,10
@@
size_t qfind_first_byte_of_needles16(const StringPieceLite haystack,
// do an unaligned load for first block of haystack
auto arr1 = _mm_loadu_si128(
reinterpret_cast<const __m128i*>(haystack.data()));
// do an unaligned load for first block of haystack
auto arr1 = _mm_loadu_si128(
reinterpret_cast<const __m128i*>(haystack.data()));
- auto index =
_mm_cmpestri(arr2, needles.size(),
-
arr1, haystack.size(
), 0);
+ auto index =
+
_mm_cmpestri(arr2, int(needles.size()), arr1, int(haystack.size()
), 0);
if (index < 16) {
if (index < 16) {
- return
index
;
+ return
size_t(index)
;
}
// Now, we can do aligned loads hereafter...
}
// Now, we can do aligned loads hereafter...
@@
-116,7
+116,8
@@
size_t qfind_first_byte_of_needles16(const StringPieceLite haystack,
for (; i < haystack.size(); i+= 16) {
arr1 =
_mm_load_si128(reinterpret_cast<const __m128i*>(haystack.data() + i));
for (; i < haystack.size(); i+= 16) {
arr1 =
_mm_load_si128(reinterpret_cast<const __m128i*>(haystack.data() + i));
- index = _mm_cmpestri(arr2, needles.size(), arr1, haystack.size() - i, 0);
+ index = _mm_cmpestri(
+ arr2, int(needles.size()), arr1, int(haystack.size() - i), 0);
if (index < 16) {
return i + index;
}
if (index < 16) {
return i + index;
}
@@
-142,7
+143,7
@@
template <bool HAYSTACK_ALIGNED>
size_t scanHaystackBlock(const StringPieceLite haystack,
const StringPieceLite needles,
uint64_t blockStartIdx) {
size_t scanHaystackBlock(const StringPieceLite haystack,
const StringPieceLite needles,
uint64_t blockStartIdx) {
- DCHECK_GT(needles.size(), 16
);
// should handled by *needles16() method
+ DCHECK_GT(needles.size(), 16
u);
// should handled by *needles16() method
DCHECK(blockStartIdx + 16 <= haystack.size() ||
(page_for(haystack.data() + blockStartIdx) ==
page_for(haystack.data() + blockStartIdx + 15)));
DCHECK(blockStartIdx + 16 <= haystack.size() ||
(page_for(haystack.data() + blockStartIdx) ==
page_for(haystack.data() + blockStartIdx + 15)));
@@
-159,8
+160,8
@@
size_t scanHaystackBlock(const StringPieceLite haystack,
// This load is safe because needles.size() >= 16
auto arr2 = _mm_loadu_si128(
reinterpret_cast<const __m128i*>(needles.data()));
// This load is safe because needles.size() >= 16
auto arr2 = _mm_loadu_si128(
reinterpret_cast<const __m128i*>(needles.data()));
- size_t b = _mm_cmpestri(
-
arr2, 16, arr1, haystack.size() - blockStartIdx
, 0);
+ auto b =
+
_mm_cmpestri(arr2, 16, arr1, int(haystack.size() - blockStartIdx)
, 0);
size_t j = nextAlignedIndex(needles.data());
for (; j < needles.size(); j += 16) {
size_t j = nextAlignedIndex(needles.data());
for (; j < needles.size(); j += 16) {
@@
-168,9
+169,12
@@
size_t scanHaystackBlock(const StringPieceLite haystack,
reinterpret_cast<const __m128i*>(needles.data() + j));
auto index = _mm_cmpestri(
reinterpret_cast<const __m128i*>(needles.data() + j));
auto index = _mm_cmpestri(
- arr2, needles.size() - j,
- arr1, haystack.size() - blockStartIdx, 0);
- b = std::min<size_t>(index, b);
+ arr2,
+ int(needles.size() - j),
+ arr1,
+ int(haystack.size() - blockStartIdx),
+ 0);
+ b = std::min(index, b);
}
if (b < 16) {
}
if (b < 16) {