Go to the documentation of this file.
15 #ifndef ABSL_STRINGS_INTERNAL_CHARCONV_BIGINT_H_
16 #define ABSL_STRINGS_INTERNAL_CHARCONV_BIGINT_H_
23 #include "absl/base/config.h"
24 #include "absl/strings/ascii.h"
25 #include "absl/strings/internal/charconv_parse.h"
26 #include "absl/strings/string_view.h"
30 namespace strings_internal {
56 template <
int max_words>
59 static_assert(max_words == 4 || max_words == 84,
60 "unsupported max_words value");
64 :
size_((
v >> 32) ? 2 :
v ? 1 : 0),
74 if (std::find_if_not(sv.begin(), sv.end(),
ascii_isdigit) != sv.end() ||
80 if (exponent_adjust > 0) {
98 return static_cast<uint64_t>(max_words) * 9975007 / 1035508;
104 const int word_shift =
count / 32;
105 if (word_shift >= max_words) {
131 if (
size_ == 0 ||
v == 1) {
142 words_[
i] = window & 0xffffffff;
146 if (window &&
size_ < max_words) {
207 if (index < 0 || index >=
size_) {
268 int other_size,
int step);
271 const int original_size =
size_;
272 const int first_step =
273 (
std::min)(original_size + other_size - 2, max_words - 1);
282 while (index < max_words && value > 0) {
322 template <u
int32_t divisor>
325 for (
int i =
size_ - 1;
i >= 0; --
i) {
330 accumulator = accumulator % divisor;
335 return static_cast<uint32_t>(accumulator);
352 template <
int N,
int M>
355 for (
int i = limit - 1;
i >= 0; --
i) {
358 if (lhs_word < rhs_word) {
360 }
else if (lhs_word > rhs_word) {
367 template <
int N,
int M>
370 for (
int i = 0;
i < limit; ++
i) {
378 template <
int N,
int M>
380 return !(lhs == rhs);
383 template <
int N,
int M>
385 return Compare(lhs, rhs) == -1;
388 template <
int N,
int M>
392 template <
int N,
int M>
396 template <
int N,
int M>
404 return os <<
num.ToString();
416 extern template class BigUnsigned<4>;
417 extern template class BigUnsigned<84>;
423 #endif // ABSL_STRINGS_INTERNAL_CHARCONV_BIGINT_H_
bool operator==(const BigUnsigned< N > &lhs, const BigUnsigned< M > &rhs)
const uint32_t * words() const
int ReadDigits(const char *begin, const char *end, int significant_digits)
static BigUnsigned FiveToTheNth(int n)
uint32_t words_[max_words]
OPENSSL_EXPORT pem_password_cb void * u
uint32_t GetWord(int index) const
bool operator<(const BigUnsigned< N > &lhs, const BigUnsigned< M > &rhs)
#define ABSL_NAMESPACE_END
bool operator>(const BigUnsigned< N > &lhs, const BigUnsigned< M > &rhs)
const ABSL_DLL uint32_t kFiveToNth[14]
constexpr int kMaxSmallPowerOfFive
void MultiplyBy(uint64_t v)
bool operator<=(const BigUnsigned< N > &lhs, const BigUnsigned< M > &rhs)
std::ostream & operator<<(std::ostream &os, const BigUnsigned< N > &num)
bool operator>=(const BigUnsigned< N > &lhs, const BigUnsigned< M > &rhs)
void MultiplyByTenToTheNth(int n)
constexpr BigUnsigned(uint64_t v)
#define ABSL_NAMESPACE_BEGIN
void MultiplyBy(int other_size, const uint32_t *other_words)
unsigned __int64 uint64_t
constexpr int kMaxSmallPowerOfTen
int ReadFloatMantissa(const ParsedFloat &fp, int significant_digits)
void MultiplyBy(uint32_t v)
void AddWithCarry(int index, uint64_t value)
void MultiplyByFiveToTheNth(int n)
void MultiplyStep(int original_size, const uint32_t *other_words, int other_size, int step)
void ShiftLeft(int count)
void MultiplyBy(const BigUnsigned< M > &other)
static constexpr int Digits10()
bool operator!=(const BigUnsigned< N > &lhs, const BigUnsigned< M > &rhs)
int Compare(const BigUnsigned< N > &lhs, const BigUnsigned< M > &rhs)
BigUnsigned(absl::string_view sv)
void AddWithCarry(int index, uint32_t value)
bool ascii_isdigit(unsigned char c)
std::string ToString() const
const ABSL_DLL uint32_t kTenToNth[10]
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:53