Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::string_t::StringComparisonOperators Struct Reference

Static Public Member Functions

static bool Equals (const string_t &a, const string_t &b)
 
static bool GreaterThan (const string_t &left, const string_t &right)
 

Member Function Documentation

◆ Equals()

static bool duckdb::string_t::StringComparisonOperators::Equals ( const string_t a,
const string_t b 
)
inlinestatic
4839 {
4840#ifdef DUCKDB_DEBUG_NO_INLINE
4841 if (a.GetSize() != b.GetSize()) {
4842 return false;
4843 }
4844 return (memcmp(a.GetData(), b.GetData(), a.GetSize()) == 0);
4845#endif
4846 uint64_t a_bulk_comp = Load<uint64_t>(const_data_ptr_cast(&a));
4847 uint64_t b_bulk_comp = Load<uint64_t>(const_data_ptr_cast(&b));
4848 if (a_bulk_comp != b_bulk_comp) {
4849 // Either length or prefix are different -> not equal
4850 return false;
4851 }
4852 // they have the same length and same prefix!
4853 a_bulk_comp = Load<uint64_t>(const_data_ptr_cast(&a) + 8u);
4854 b_bulk_comp = Load<uint64_t>(const_data_ptr_cast(&b) + 8u);
4855 if (a_bulk_comp == b_bulk_comp) {
4856 // either they are both inlined (so compare equal) or point to the same string (so compare equal)
4857 return true;
4858 }
4859 if (!a.IsInlined()) {
4860 // 'long' strings of the same length -> compare pointed value
4861 if (memcmp(a.value.pointer.ptr, b.value.pointer.ptr, a.GetSize()) == 0) {
4862 return true;
4863 }
4864 }
4865 // either they are short string of same length but different content
4866 // or they point to string with different content
4867 // either way, they can't represent the same underlying string
4868 return false;
4869 }
::uint64_t uint64_t

◆ GreaterThan()

static bool duckdb::string_t::StringComparisonOperators::GreaterThan ( const string_t left,
const string_t right 
)
inlinestatic
4871 {
4872 const uint32_t left_length = UnsafeNumericCast<uint32_t>(left.GetSize());
4873 const uint32_t right_length = UnsafeNumericCast<uint32_t>(right.GetSize());
4874 const uint32_t min_length = std::min<uint32_t>(left_length, right_length);
4875
4876#ifndef DUCKDB_DEBUG_NO_INLINE
4877 uint32_t a_prefix = Load<uint32_t>(const_data_ptr_cast(left.GetPrefix()));
4878 uint32_t b_prefix = Load<uint32_t>(const_data_ptr_cast(right.GetPrefix()));
4879
4880 // Check on prefix -----
4881 // We don't need to mask since:
4882 // if the prefix is greater(after bswap), it will stay greater regardless of the extra bytes
4883 // if the prefix is smaller(after bswap), it will stay smaller regardless of the extra bytes
4884 // if the prefix is equal, the extra bytes are guaranteed to be /0 for the shorter one
4885
4886 if (a_prefix != b_prefix) {
4887 return BSwapIfLE(a_prefix) > BSwapIfLE(b_prefix);
4888 }
4889#endif
4890 auto memcmp_res = memcmp(left.GetData(), right.GetData(), min_length);
4891 return memcmp_res > 0 || (memcmp_res == 0 && left_length > right_length);
4892 }
::uint32_t uint32_t

The documentation for this struct was generated from the following file: