+3
-14
lines changedFilter options
+3
-14
lines changed Original file line number Diff line number Diff line change
@@ -930,12 +930,9 @@ template <typename T> class buffer {
930
930
try_reserve(size_ + count);
931
931
auto free_cap = capacity_ - size_;
932
932
if (free_cap < count) count = free_cap;
933
-
if (std::is_same<T, U>::value) {
934
-
memcpy(ptr_ + size_, begin, count * sizeof(T));
935
-
} else {
936
-
T* out = ptr_ + size_;
937
-
for (size_t i = 0; i < count; ++i) out[i] = begin[i];
938
-
}
933
+
// A loop is faster than memcpy on small sizes.
934
+
T* out = ptr_ + size_;
935
+
for (size_t i = 0; i < count; ++i) out[i] = begin[i];
939
936
size_ += count;
940
937
begin += count;
941
938
}
@@ -1217,14 +1214,6 @@ FMT_CONSTEXPR auto copy(InputIt begin, InputIt end, OutputIt out) -> OutputIt {
1217
1214
return out;
1218
1215
}
1219
1216
1220
-
template <typename T>
1221
-
FMT_CONSTEXPR auto copy(const T* begin, const T* end, T* out) -> T* {
1222
-
if (is_constant_evaluated()) return copy<T, const T*, T*>(begin, end, out);
1223
-
auto size = to_unsigned(end - begin);
1224
-
if (size > 0) memcpy(out, begin, size * sizeof(T));
1225
-
return out + size;
1226
-
}
1227
-
1228
1217
template <typename T, typename V, typename OutputIt>
1229
1218
FMT_CONSTEXPR auto copy(basic_string_view<V> s, OutputIt out) -> OutputIt {
1230
1219
return copy<T>(s.begin(), s.end(), out);
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4