Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions be/src/vec/common/memcmp_small.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <algorithm>
#include <cstdint>

namespace detail {
namespace doris::vectorized::detail {

template <typename T>
int cmp(T a, T b) {
Expand All @@ -32,7 +32,7 @@ int cmp(T a, T b) {
return 0;
}

} // namespace detail
} // namespace doris::vectorized::detail

/// We can process uninitialized memory in the functions below.
/// Results don't depend on the values inside uninitialized memory but Memory Sanitizer cannot see it.
Expand Down Expand Up @@ -63,11 +63,11 @@ int memcmp_small_allow_overflow15(const Char* a, size_t a_size, const Char* b, s

if (offset >= min_size) break;

return detail::cmp(a[offset], b[offset]);
return doris::vectorized::detail::cmp(a[offset], b[offset]);
}
}

return detail::cmp(a_size, b_size);
return doris::vectorized::detail::cmp(a_size, b_size);
}

/** Variant when memory regions have same size.
Expand All @@ -86,7 +86,7 @@ int memcmp_small_allow_overflow15(const Char* a, const Char* b, size_t size) {

if (offset >= size) return 0;

return detail::cmp(a[offset], b[offset]);
return doris::vectorized::detail::cmp(a[offset], b[offset]);
}
}

Expand Down Expand Up @@ -126,7 +126,7 @@ int memcmp_small_multiple_of16(const Char* a, const Char* b, size_t size) {

if (mask) {
offset += __builtin_ctz(mask);
return detail::cmp(a[offset], b[offset]);
return doris::vectorized::detail::cmp(a[offset], b[offset]);
}
}

Expand All @@ -144,7 +144,7 @@ int memcmp16(const Char* a, const Char* b) {

if (mask) {
auto offset = __builtin_ctz(mask);
return detail::cmp(a[offset], b[offset]);
return doris::vectorized::detail::cmp(a[offset], b[offset]);
}

return 0;
Expand Down Expand Up @@ -186,7 +186,7 @@ int memcmp_small_allow_overflow15(const Char* a, size_t a_size, const Char* b, s
if (auto res = memcmp(a, b, std::min(a_size, b_size)))
return res;
else
return detail::cmp(a_size, b_size);
return doris::vectorized::detail::cmp(a_size, b_size);
}

template <typename Char>
Expand Down
8 changes: 4 additions & 4 deletions be/src/vec/common/memcpy_small.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
* Use with caution.
*/

namespace detail {
namespace doris::vectorized::detail {
inline void memcpy_small_allow_read_write_overflow15_impl(char* __restrict dst,
const char* __restrict src, ssize_t n) {
while (n > 0) {
Expand All @@ -58,15 +58,15 @@ inline void memcpy_small_allow_read_write_overflow15_impl(char* __restrict dst,
n -= 16;
}
}
} // namespace detail
} // namespace doris::vectorized::detail

/** Works under assumption, that it's possible to read up to 15 excessive bytes after end of 'src' region
* and to write any garbage into up to 15 bytes after end of 'dst' region.
*/
inline void memcpy_small_allow_read_write_overflow15(void* __restrict dst,
const void* __restrict src, size_t n) {
detail::memcpy_small_allow_read_write_overflow15_impl(reinterpret_cast<char*>(dst),
reinterpret_cast<const char*>(src), n);
doris::vectorized::detail::memcpy_small_allow_read_write_overflow15_impl(
reinterpret_cast<char*>(dst), reinterpret_cast<const char*>(src), n);
}

/** NOTE There was also a function, that assumes, that you could read any bytes inside same memory page of src.
Expand Down
4 changes: 2 additions & 2 deletions be/src/vec/common/string_utils/string_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "vec/common/string_utils/string_utils.h"

namespace detail {
namespace doris::vectorized::detail {

bool starts_with(const std::string& s, const char* prefix, size_t prefix_size) {
return s.size() >= prefix_size && 0 == memcmp(s.data(), prefix, prefix_size);
Expand All @@ -31,4 +31,4 @@ bool ends_with(const std::string& s, const char* suffix, size_t suffix_size) {
0 == memcmp(s.data() + s.size() - suffix_size, suffix, suffix_size);
}

} // namespace detail
} // namespace doris::vectorized::detail
12 changes: 6 additions & 6 deletions be/src/vec/common/string_utils/string_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@
#include <cstring>
#include <string>

namespace detail {
namespace doris::vectorized::detail {
bool starts_with(const std::string& s, const char* prefix, size_t prefix_size);
bool ends_with(const std::string& s, const char* suffix, size_t suffix_size);
} // namespace detail
} // namespace doris::vectorized::detail

inline bool starts_with(const std::string& s, const std::string& prefix) {
return detail::starts_with(s, prefix.data(), prefix.size());
return doris::vectorized::detail::starts_with(s, prefix.data(), prefix.size());
}

inline bool ends_with(const std::string& s, const std::string& suffix) {
return detail::ends_with(s, suffix.data(), suffix.size());
return doris::vectorized::detail::ends_with(s, suffix.data(), suffix.size());
}

/// With GCC, strlen is evaluated compile time if we pass it a constant
/// string that is known at compile time.
inline bool starts_with(const std::string& s, const char* prefix) {
return detail::starts_with(s, prefix, strlen(prefix));
return doris::vectorized::detail::starts_with(s, prefix, strlen(prefix));
}

inline bool ends_with(const std::string& s, const char* suffix) {
return detail::ends_with(s, suffix, strlen(suffix));
return doris::vectorized::detail::ends_with(s, suffix, strlen(suffix));
}

/// Given an integer, return the adequate suffix for
Expand Down