MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / compare

Method compare

source/extern/fmt/format.h:2916–2931  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2914 }
2915
2916 friend FMT_CONSTEXPR20 auto compare(const bigint& lhs, const bigint& rhs)
2917 -> int {
2918 int num_lhs_bigits = lhs.num_bigits(), num_rhs_bigits = rhs.num_bigits();
2919 if (num_lhs_bigits != num_rhs_bigits)
2920 return num_lhs_bigits > num_rhs_bigits ? 1 : -1;
2921 int i = static_cast<int>(lhs.bigits_.size()) - 1;
2922 int j = static_cast<int>(rhs.bigits_.size()) - 1;
2923 int end = i - j;
2924 if (end < 0) end = 0;
2925 for (; i >= end; --i, --j) {
2926 bigit lhs_bigit = lhs[i], rhs_bigit = rhs[j];
2927 if (lhs_bigit != rhs_bigit) return lhs_bigit > rhs_bigit ? 1 : -1;
2928 }
2929 if (i != j) return i > j ? 1 : -1;
2930 return 0;
2931 }
2932
2933 // Returns compare(lhs1 + lhs2, rhs).
2934 friend FMT_CONSTEXPR20 auto add_compare(const bigint& lhs1,

Callers 6

operator==Function · 0.45
operator!=Function · 0.45
operator<Function · 0.45
operator<=Function · 0.45
operator>Function · 0.45
operator>=Function · 0.45

Calls 2

num_bigitsMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected