Fix build failure with GCC 5
[folly.git] / folly / detail / RangeSse42.cpp
index 4bd75be4647e5aa1d3a76b8a2887133eb941cb5f..fc9a759f3cf3be984cc4c35c9a0b38747e2126a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -108,7 +108,7 @@ size_t qfind_first_byte_of_needles16(const StringPieceLite haystack,
   auto index =
       _mm_cmpestri(arr2, int(needles.size()), arr1, int(haystack.size()), 0);
   if (index < 16) {
-    return index;
+    return size_t(index);
   }
 
   // Now, we can do aligned loads hereafter...
@@ -160,7 +160,7 @@ 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()));
-  size_t b =
+  auto b =
       _mm_cmpestri(arr2, 16, arr1, int(haystack.size() - blockStartIdx), 0);
 
   size_t j = nextAlignedIndex(needles.data());
@@ -174,7 +174,7 @@ size_t scanHaystackBlock(const StringPieceLite haystack,
         arr1,
         int(haystack.size() - blockStartIdx),
         0);
-    b = std::min<size_t>(index, b);
+    b = std::min(index, b);
   }
 
   if (b < 16) {