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::Uhugeint Class Reference

The uhugeint class contains static operations for the UINT128 type. More...

#include <duckdb.hpp>

Collaboration diagram for duckdb::Uhugeint:

Public Member Functions

template<>
bool TryCast (uhugeint_t input, int8_t &result)
template<>
bool TryCast (uhugeint_t input, int16_t &result)
template<>
bool TryCast (uhugeint_t input, int32_t &result)
template<>
bool TryCast (uhugeint_t input, int64_t &result)
template<>
bool TryCast (uhugeint_t input, uint8_t &result)
template<>
bool TryCast (uhugeint_t input, uint16_t &result)
template<>
bool TryCast (uhugeint_t input, uint32_t &result)
template<>
bool TryCast (uhugeint_t input, uint64_t &result)
template<>
bool TryCast (uhugeint_t input, uhugeint_t &result)
template<>
bool TryCast (uhugeint_t input, hugeint_t &result)
template<>
bool TryCast (uhugeint_t input, float &result)
template<>
bool TryCast (uhugeint_t input, double &result)
template<>
bool TryConvert (const char *value, uhugeint_t &result)
template<>
bool TryConvert (int8_t value, uhugeint_t &result)
template<>
bool TryConvert (int16_t value, uhugeint_t &result)
template<>
bool TryConvert (int32_t value, uhugeint_t &result)
template<>
bool TryConvert (int64_t value, uhugeint_t &result)
template<>
bool TryConvert (uint8_t value, uhugeint_t &result)
template<>
bool TryConvert (uint16_t value, uhugeint_t &result)
template<>
bool TryConvert (uint32_t value, uhugeint_t &result)
template<>
bool TryConvert (uint64_t value, uhugeint_t &result)
template<>
bool TryConvert (uhugeint_t value, uhugeint_t &result)
template<>
bool TryConvert (float value, uhugeint_t &result)
template<>
bool TryConvert (double value, uhugeint_t &result)
template<>
bool TryConvert (long double value, uhugeint_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, int8_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, int16_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, int32_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, int64_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, uint8_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, uint16_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, uint32_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, uint64_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, hugeint_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, uhugeint_t &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, float &result)
template<>
DUCKDB_API bool TryCast (uhugeint_t input, double &result)
template<>
bool TryConvert (int8_t value, uhugeint_t &result)
template<>
bool TryConvert (int16_t value, uhugeint_t &result)
template<>
bool TryConvert (int32_t value, uhugeint_t &result)
template<>
bool TryConvert (int64_t value, uhugeint_t &result)
template<>
bool TryConvert (uint8_t value, uhugeint_t &result)
template<>
bool TryConvert (uint16_t value, uhugeint_t &result)
template<>
bool TryConvert (uint32_t value, uhugeint_t &result)
template<>
bool TryConvert (uint64_t value, uhugeint_t &result)
template<>
bool TryConvert (float value, uhugeint_t &result)
template<>
bool TryConvert (double value, uhugeint_t &result)
template<>
bool TryConvert (long double value, uhugeint_t &result)
template<>
bool TryConvert (const char *value, uhugeint_t &result)

Static Public Member Functions

static string ToString (uhugeint_t input)
 Convert a uhugeint object to a string.
template<class T>
static DUCKDB_API bool TryCast (uhugeint_t input, T &result)
template<class T>
static T Cast (uhugeint_t input)
template<class T>
static bool TryConvert (T value, uhugeint_t &result)
template<class T>
static uhugeint_t Convert (T value)
static bool TryNegate (uhugeint_t input, uhugeint_t &result)
template<bool CHECK_OVERFLOW = true>
static void NegateInPlace (uhugeint_t &input)
template<bool CHECK_OVERFLOW = true>
static uhugeint_t Negate (uhugeint_t input)
static bool TryMultiply (uhugeint_t lhs, uhugeint_t rhs, uhugeint_t &result)
template<bool CHECK_OVERFLOW = true>
static uhugeint_t Multiply (uhugeint_t lhs, uhugeint_t rhs)
static bool TryDivMod (uhugeint_t lhs, uhugeint_t rhs, uhugeint_t &result, uhugeint_t &remainder)
template<bool CHECK_OVERFLOW = true>
static uhugeint_t Divide (uhugeint_t lhs, uhugeint_t rhs)
template<bool CHECK_OVERFLOW = true>
static uhugeint_t Modulo (uhugeint_t lhs, uhugeint_t rhs)
static bool TryAddInPlace (uhugeint_t &lhs, uhugeint_t rhs)
template<bool CHECK_OVERFLOW = true>
static uhugeint_t Add (uhugeint_t lhs, uhugeint_t rhs)
static bool TrySubtractInPlace (uhugeint_t &lhs, uhugeint_t rhs)
template<bool CHECK_OVERFLOW = true>
static uhugeint_t Subtract (uhugeint_t lhs, uhugeint_t rhs)
static uhugeint_t DivMod (uhugeint_t lhs, uhugeint_t rhs, uhugeint_t &remainder)
static int Sign (hugeint_t n)
static hugeint_t Abs (hugeint_t n)
static bool Equals (uhugeint_t lhs, uhugeint_t rhs)
static bool NotEquals (uhugeint_t lhs, uhugeint_t rhs)
static bool GreaterThan (uhugeint_t lhs, uhugeint_t rhs)
static bool GreaterThanEquals (uhugeint_t lhs, uhugeint_t rhs)
static bool LessThan (uhugeint_t lhs, uhugeint_t rhs)
static bool LessThanEquals (uhugeint_t lhs, uhugeint_t rhs)
template<>
void NegateInPlace (uhugeint_t &input)
template<>
uhugeint_t Multiply (uhugeint_t lhs, uhugeint_t rhs)
template<>
uhugeint_t Divide (uhugeint_t lhs, uhugeint_t rhs)
template<>
uhugeint_t Modulo (uhugeint_t lhs, uhugeint_t rhs)
template<>
uhugeint_t Add (uhugeint_t lhs, uhugeint_t rhs)
template<>
uhugeint_t Subtract (uhugeint_t lhs, uhugeint_t rhs)

Static Public Attributes

static constexpr uint8_t CACHED_POWERS_OF_TEN = 39
static const uhugeint_t POWERS_OF_TEN [CACHED_POWERS_OF_TEN]

Detailed Description

The uhugeint class contains static operations for the UINT128 type.

Member Function Documentation

◆ ToString()

string duckdb::Uhugeint::ToString ( uhugeint_t input)
static

Convert a uhugeint object to a string.

130182 {
130183 uhugeint_t remainder;
130184 string result;
130185 while (true) {
130186 if (!input.lower && !input.upper) {
130187 break;
130188 }
130189 input = Uhugeint::DivMod(input, 10, remainder);
130190 result = string(1, UnsafeNumericCast<char>('0' + remainder.lower)) + result; // NOLINT
130191 }
130192 if (result.empty()) {
130193 // value is zero
130194 return "0";
130195 }
130196 return result;
130197}

◆ Cast()

template<class T>
T duckdb::Uhugeint::Cast ( uhugeint_t input)
inlinestatic
52506 {
52507 T result = 0;
52508 TryCast(input, result);
52509 return result;
52510 }

◆ Convert()

template<class T>
uhugeint_t duckdb::Uhugeint::Convert ( T value)
inlinestatic
52516 {
52517 uhugeint_t result;
52518 if (!TryConvert(value, result)) { // LCOV_EXCL_START
52519 throw OutOfRangeException(double(value), GetTypeId<T>(), GetTypeId<uhugeint_t>());
52520 } // LCOV_EXCL_STOP
52521 return result;
52522 }
PhysicalType GetTypeId()
Returns the PhysicalType for the given type.
Definition duckdb.hpp:10381

◆ TryNegate()

bool duckdb::Uhugeint::TryNegate ( uhugeint_t input,
uhugeint_t & result )
static
130210 {
130211 // unsigned integers can always be negated
130212 Uhugeint::NegateInPlace<false>(input);
130213 result = input;
130214 return true;
130215}

◆ NegateInPlace() [1/2]

template<bool CHECK_OVERFLOW = true>
void duckdb::Uhugeint::NegateInPlace ( uhugeint_t & input)
inlinestatic
52529 {
52530 if (!TryNegate(input, input)) {
52531 throw OutOfRangeException("UHUGEINT is out of range");
52532 }
52533 }

◆ Negate()

template<bool CHECK_OVERFLOW = true>
uhugeint_t duckdb::Uhugeint::Negate ( uhugeint_t input)
inlinestatic
52536 {
52537 NegateInPlace<CHECK_OVERFLOW>(input);
52538 return input;
52539 }

◆ TryMultiply()

bool duckdb::Uhugeint::TryMultiply ( uhugeint_t lhs,
uhugeint_t rhs,
uhugeint_t & result )
static
130220 {
130221#if ((__GNUC__ >= 5) || defined(__clang__)) && defined(__SIZEOF_INT128__)
130222 __uint128_t left = __uint128_t(lhs.lower) + (__uint128_t(lhs.upper) << 64);
130223 __uint128_t right = __uint128_t(rhs.lower) + (__uint128_t(rhs.upper) << 64);
130224 __uint128_t result_u128;
130225 if (__builtin_mul_overflow(left, right, &result_u128)) {
130226 return false;
130227 }
130228 result.upper = uint64_t(result_u128 >> 64);
130229 result.lower = uint64_t(result_u128 & 0xffffffffffffffff);
130230#else
130231 // split values into 4 32-bit parts
130232 uint64_t top[4] = {lhs.upper >> 32, lhs.upper & 0xffffffff, lhs.lower >> 32, lhs.lower & 0xffffffff};
130233 uint64_t bottom[4] = {rhs.upper >> 32, rhs.upper & 0xffffffff, rhs.lower >> 32, rhs.lower & 0xffffffff};
130234 uint64_t products[4][4];
130235
130236 // multiply each component of the values
130237 for (int y = 3; y > -1; y--) {
130238 for (int x = 3; x > -1; x--) {
130239 products[3 - x][y] = top[x] * bottom[y];
130240 }
130241 }
130242
130243 // if any of these products are set to a non-zero value, there is always an overflow
130244 if (products[2][1] || products[1][0] || products[2][0]) {
130245 return false;
130246 }
130247
130248 // if the high bits of any of these are set, there is always an overflow
130249 if (products[1][1] & 0xffffffff00000000 || products[3][0] & 0xffffffff00000000 ||
130250 products[3][3] & 0xffffffff00000000 || products[3][2] & 0xffffffff00000000 ||
130251 products[3][1] & 0xffffffff00000000 || products[2][2] & 0xffffffff00000000 ||
130252 products[0][0] & 0xffffffff00000000) {
130253 return false;
130254 }
130255
130256 // first row
130257 uint64_t fourth32 = (products[0][3] & 0xffffffff);
130258 uint64_t third32 = (products[0][2] & 0xffffffff) + (products[0][3] >> 32);
130259 uint64_t second32 = (products[0][1] & 0xffffffff) + (products[0][2] >> 32);
130260 uint64_t first32 = (products[0][0] & 0xffffffff) + (products[0][1] >> 32);
130261
130262 // second row
130263 third32 += (products[1][3] & 0xffffffff);
130264 second32 += (products[1][2] & 0xffffffff) + (products[1][3] >> 32);
130265 first32 += (products[1][1] & 0xffffffff) + (products[1][2] >> 32);
130266
130267 // third row
130268 second32 += (products[2][3] & 0xffffffff);
130269 first32 += (products[2][2] & 0xffffffff) + (products[2][3] >> 32);
130270
130271 // fourth row
130272 first32 += (products[3][3] & 0xffffffff);
130273
130274 // move carry to next digit
130275 third32 += fourth32 >> 32;
130276 second32 += third32 >> 32;
130277 first32 += second32 >> 32;
130278
130279 // remove carry from current digit
130280 fourth32 &= 0xffffffff;
130281 third32 &= 0xffffffff;
130282 second32 &= 0xffffffff;
130283 first32 &= 0xffffffff;
130284
130285 // combine components
130286 result.lower = (third32 << 32) | fourth32;
130287 result.upper = (first32 << 32) | second32;
130288#endif
130289 return true;
130290}
::uint64_t uint64_t

◆ Multiply() [1/2]

template<bool CHECK_OVERFLOW = true>
uhugeint_t duckdb::Uhugeint::Multiply ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52544 {
52545 uhugeint_t result;
52546 if (!TryMultiply(lhs, rhs, result)) {
52547 throw OutOfRangeException("Overflow in UHUGEINT multiplication: %s * %s", lhs.ToString(), rhs.ToString());
52548 }
52549 return result;
52550 }

◆ Divide() [1/2]

template<bool CHECK_OVERFLOW = true>
uhugeint_t duckdb::Uhugeint::Divide ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52555 {
52556 // division between two same-size unsigned integers can only go wrong with division by zero
52557 if (rhs == 0) {
52558 throw OutOfRangeException("Division of UHUGEINT by zero: %s / %s", lhs.ToString(), rhs.ToString());
52559 }
52560 return Divide<false>(lhs, rhs);
52561 }

◆ Modulo() [1/2]

template<bool CHECK_OVERFLOW = true>
uhugeint_t duckdb::Uhugeint::Modulo ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52564 {
52565 if (rhs == 0) {
52566 throw OutOfRangeException("Modulo of UHUGEINT by zero: %s %% %s", lhs.ToString(), rhs.ToString());
52567 }
52568 return Modulo<false>(lhs, rhs);
52569 }

◆ TryAddInPlace()

bool duckdb::Uhugeint::TryAddInPlace ( uhugeint_t & lhs,
uhugeint_t rhs )
static
130429 {
130430 uint64_t new_upper = lhs.upper + rhs.upper;
130431 bool no_overflow = !(new_upper < lhs.upper || new_upper < rhs.upper);
130432 new_upper += (lhs.lower + rhs.lower) < lhs.lower;
130433 if (new_upper < lhs.upper || new_upper < rhs.upper) {
130434 no_overflow = false;
130435 }
130436 lhs.upper = new_upper;
130437 lhs.lower += rhs.lower;
130438 return no_overflow;
130439}

◆ Add() [1/2]

template<bool CHECK_OVERFLOW = true>
uhugeint_t duckdb::Uhugeint::Add ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52574 {
52575 if (!TryAddInPlace(lhs, rhs)) {
52576 throw OutOfRangeException("Overflow in UHUGEINT addition: %s + %s", lhs.ToString(), rhs.ToString());
52577 }
52578 return lhs;
52579 }

◆ TrySubtractInPlace()

bool duckdb::Uhugeint::TrySubtractInPlace ( uhugeint_t & lhs,
uhugeint_t rhs )
static
130441 {
130442 uint64_t new_upper = lhs.upper - rhs.upper - ((lhs.lower - rhs.lower) > lhs.lower);
130443 bool no_overflow = !(new_upper > lhs.upper);
130444 lhs.lower -= rhs.lower;
130445 lhs.upper = new_upper;
130446 return no_overflow;
130447}

◆ Subtract() [1/2]

template<bool CHECK_OVERFLOW = true>
uhugeint_t duckdb::Uhugeint::Subtract ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52584 {
52585 if (!TrySubtractInPlace(lhs, rhs)) {
52586 throw OutOfRangeException("Underflow in HUGEINT subtraction: %s - %s", lhs.ToString(), rhs.ToString());
52587 }
52588 return lhs;
52589 }

◆ DivMod()

uhugeint_t duckdb::Uhugeint::DivMod ( uhugeint_t lhs,
uhugeint_t rhs,
uhugeint_t & remainder )
static
130380 {
130381 if (rhs == 0) {
130382 remainder = lhs;
130383 return uhugeint_t(0);
130384 }
130385
130386 remainder = uhugeint_t(0);
130387 if (rhs == uhugeint_t(1)) {
130388 return lhs;
130389 } else if (lhs == rhs) {
130390 return uhugeint_t(1);
130391 } else if (lhs == uhugeint_t(0) || lhs < rhs) {
130392 remainder = lhs;
130393 return uhugeint_t(0);
130394 }
130395
130396 uhugeint_t result = 0;
130397 for (uint8_t idx = Bits(lhs); idx > 0; --idx) {
130398 result <<= 1;
130399 remainder <<= 1;
130400
130401 if (((lhs >> (idx - 1U)) & 1) != 0) {
130402 remainder += 1;
130403 }
130404
130405 if (remainder >= rhs) {
130406 remainder -= rhs;
130407 result += 1;
130408 }
130409 }
130410 return result;
130411}

◆ Equals()

bool duckdb::Uhugeint::Equals ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52598 {
52599 bool lower_equals = lhs.lower == rhs.lower;
52600 bool upper_equals = lhs.upper == rhs.upper;
52601 return lower_equals && upper_equals;
52602 }

◆ NotEquals()

bool duckdb::Uhugeint::NotEquals ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52604 {
52605 return !Equals(lhs, rhs);
52606 }

◆ GreaterThan()

bool duckdb::Uhugeint::GreaterThan ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52608 {
52609 bool upper_bigger = lhs.upper > rhs.upper;
52610 bool upper_equal = lhs.upper == rhs.upper;
52611 bool lower_bigger = lhs.lower > rhs.lower;
52612 return upper_bigger || (upper_equal && lower_bigger);
52613 }

◆ GreaterThanEquals()

bool duckdb::Uhugeint::GreaterThanEquals ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52615 {
52616 bool upper_bigger = lhs.upper > rhs.upper;
52617 bool upper_equal = lhs.upper == rhs.upper;
52618 bool lower_bigger_equals = lhs.lower >= rhs.lower;
52619 return upper_bigger || (upper_equal && lower_bigger_equals);
52620 }

◆ LessThan()

bool duckdb::Uhugeint::LessThan ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52622 {
52623 bool upper_smaller = lhs.upper < rhs.upper;
52624 bool upper_equal = lhs.upper == rhs.upper;
52625 bool lower_smaller = lhs.lower < rhs.lower;
52626 return upper_smaller || (upper_equal && lower_smaller);
52627 }

◆ LessThanEquals()

bool duckdb::Uhugeint::LessThanEquals ( uhugeint_t lhs,
uhugeint_t rhs )
inlinestatic
52629 {
52630 bool upper_smaller = lhs.upper < rhs.upper;
52631 bool upper_equal = lhs.upper == rhs.upper;
52632 bool lower_smaller_equals = lhs.lower <= rhs.lower;
52633 return upper_smaller || (upper_equal && lower_smaller_equals);
52634 }

◆ NegateInPlace() [2/2]

template<>
void duckdb::Uhugeint::NegateInPlace ( uhugeint_t & input)
static
130204 {
130205 uhugeint_t result = 0;
130206 result -= input;
130207 input = result;
130208}

◆ Multiply() [2/2]

template<>
uhugeint_t duckdb::Uhugeint::Multiply ( uhugeint_t lhs,
uhugeint_t rhs )
static
130294 {
130295 uhugeint_t result;
130296#if ((__GNUC__ >= 5) || defined(__clang__)) && defined(__SIZEOF_INT128__)
130297 __uint128_t left = __uint128_t(lhs.lower) + (__uint128_t(lhs.upper) << 64);
130298 __uint128_t right = __uint128_t(rhs.lower) + (__uint128_t(rhs.upper) << 64);
130299 __uint128_t result_u128;
130300
130301 result_u128 = left * right;
130302 result.upper = uint64_t(result_u128 >> 64);
130303 result.lower = uint64_t(result_u128 & 0xffffffffffffffff);
130304#else
130305 // split values into 4 32-bit parts
130306 uint64_t top[4] = {lhs.upper >> 32, lhs.upper & 0xffffffff, lhs.lower >> 32, lhs.lower & 0xffffffff};
130307 uint64_t bottom[4] = {rhs.upper >> 32, rhs.upper & 0xffffffff, rhs.lower >> 32, rhs.lower & 0xffffffff};
130308 uint64_t products[4][4];
130309
130310 // multiply each component of the values
130311 for (int y = 3; y > -1; y--) {
130312 for (int x = 3; x > -1; x--) {
130313 products[3 - x][y] = top[x] * bottom[y];
130314 }
130315 }
130316
130317 // first row
130318 uint64_t fourth32 = (products[0][3] & 0xffffffff);
130319 uint64_t third32 = (products[0][2] & 0xffffffff) + (products[0][3] >> 32);
130320 uint64_t second32 = (products[0][1] & 0xffffffff) + (products[0][2] >> 32);
130321 uint64_t first32 = (products[0][0] & 0xffffffff) + (products[0][1] >> 32);
130322
130323 // second row
130324 third32 += (products[1][3] & 0xffffffff);
130325 second32 += (products[1][2] & 0xffffffff) + (products[1][3] >> 32);
130326 first32 += (products[1][1] & 0xffffffff) + (products[1][2] >> 32);
130327
130328 // third row
130329 second32 += (products[2][3] & 0xffffffff);
130330 first32 += (products[2][2] & 0xffffffff) + (products[2][3] >> 32);
130331
130332 // fourth row
130333 first32 += (products[3][3] & 0xffffffff);
130334
130335 // move carry to next digit
130336 third32 += fourth32 >> 32;
130337 second32 += third32 >> 32;
130338 first32 += second32 >> 32;
130339
130340 // remove carry from current digit
130341 fourth32 &= 0xffffffff;
130342 third32 &= 0xffffffff;
130343 second32 &= 0xffffffff;
130344 first32 &= 0xffffffff;
130345
130346 // combine components
130347 result.lower = (third32 << 32) | fourth32;
130348 result.upper = (first32 << 32) | second32;
130349#endif
130350 return result;
130351}

◆ Divide() [2/2]

template<>
uhugeint_t duckdb::Uhugeint::Divide ( uhugeint_t lhs,
uhugeint_t rhs )
static
130414 {
130415 uhugeint_t remainder;
130416 return Uhugeint::DivMod(lhs, rhs, remainder);
130417}

◆ Modulo() [2/2]

template<>
uhugeint_t duckdb::Uhugeint::Modulo ( uhugeint_t lhs,
uhugeint_t rhs )
static
130420 {
130421 uhugeint_t remainder;
130422 (void)Uhugeint::DivMod(lhs, rhs, remainder);
130423 return remainder;
130424}

◆ Add() [2/2]

template<>
uhugeint_t duckdb::Uhugeint::Add ( uhugeint_t lhs,
uhugeint_t rhs )
static
130450 {
130451 return lhs + rhs;
130452}

◆ Subtract() [2/2]

template<>
uhugeint_t duckdb::Uhugeint::Subtract ( uhugeint_t lhs,
uhugeint_t rhs )
static
130455 {
130456 return lhs - rhs;
130457}

◆ TryCast() [1/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
int8_t & result )
130472 {
130473 return UhugeintTryCastInteger<int8_t>(input, result);
130474}

◆ TryCast() [2/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
int16_t & result )
130477 {
130478 return UhugeintTryCastInteger<int16_t>(input, result);
130479}

◆ TryCast() [3/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
int32_t & result )
130482 {
130483 return UhugeintTryCastInteger<int32_t>(input, result);
130484}

◆ TryCast() [4/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
int64_t & result )
130487 {
130488 return UhugeintTryCastInteger<int64_t>(input, result);
130489}

◆ TryCast() [5/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
uint8_t & result )
130492 {
130493 return UhugeintTryCastInteger<uint8_t>(input, result);
130494}

◆ TryCast() [6/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
uint16_t & result )
130497 {
130498 return UhugeintTryCastInteger<uint16_t>(input, result);
130499}

◆ TryCast() [7/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
uint32_t & result )
130502 {
130503 return UhugeintTryCastInteger<uint32_t>(input, result);
130504}

◆ TryCast() [8/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
uint64_t & result )
130507 {
130508 return UhugeintTryCastInteger<uint64_t>(input, result);
130509}

◆ TryCast() [9/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
uhugeint_t & result )
130512 {
130513 result = input;
130514 return true;
130515}

◆ TryCast() [10/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
hugeint_t & result )
130518 {
130519 if (input > uhugeint_t(NumericLimits<hugeint_t>::Maximum())) {
130520 return false;
130521 }
130522
130523 result.lower = input.lower;
130524 result.upper = UnsafeNumericCast<int64_t>(input.upper);
130525 return true;
130526}

◆ TryCast() [11/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
float & result )
130529 {
130530 double dbl_result;
130531 Uhugeint::TryCast(input, dbl_result);
130532 result = (float)dbl_result;
130533 return true;
130534}

◆ TryCast() [12/12]

template<>
bool duckdb::Uhugeint::TryCast ( uhugeint_t input,
double & result )
130543 {
130544 return CastUhugeintToFloating<double>(input, result);
130545}

◆ TryConvert() [1/13]

template<>
bool duckdb::Uhugeint::TryConvert ( const char * value,
uhugeint_t & result )
130556 {
130557 auto len = strlen(value);
130558 string_t string_val(value, UnsafeNumericCast<uint32_t>(len));
130559 return TryCast::Operation<string_t, uhugeint_t>(string_val, result, true);
130560}

◆ TryConvert() [2/13]

template<>
bool duckdb::Uhugeint::TryConvert ( int8_t value,
uhugeint_t & result )
130563 {
130564 if (value < 0) {
130565 return false;
130566 }
130567 result = UhugeintConvertInteger<int8_t>(value);
130568 return true;
130569}

◆ TryConvert() [3/13]

template<>
bool duckdb::Uhugeint::TryConvert ( int16_t value,
uhugeint_t & result )
130572 {
130573 if (value < 0) {
130574 return false;
130575 }
130576 result = UhugeintConvertInteger<int16_t>(value);
130577 return true;
130578}

◆ TryConvert() [4/13]

template<>
bool duckdb::Uhugeint::TryConvert ( int32_t value,
uhugeint_t & result )
130581 {
130582 if (value < 0) {
130583 return false;
130584 }
130585 result = UhugeintConvertInteger<int32_t>(value);
130586 return true;
130587}

◆ TryConvert() [5/13]

template<>
bool duckdb::Uhugeint::TryConvert ( int64_t value,
uhugeint_t & result )
130590 {
130591 if (value < 0) {
130592 return false;
130593 }
130594 result = UhugeintConvertInteger<int64_t>(value);
130595 return true;
130596}

◆ TryConvert() [6/13]

template<>
bool duckdb::Uhugeint::TryConvert ( uint8_t value,
uhugeint_t & result )
130598 {
130599 result = UhugeintConvertInteger<uint8_t>(value);
130600 return true;
130601}

◆ TryConvert() [7/13]

template<>
bool duckdb::Uhugeint::TryConvert ( uint16_t value,
uhugeint_t & result )
130603 {
130604 result = UhugeintConvertInteger<uint16_t>(value);
130605 return true;
130606}

◆ TryConvert() [8/13]

template<>
bool duckdb::Uhugeint::TryConvert ( uint32_t value,
uhugeint_t & result )
130608 {
130609 result = UhugeintConvertInteger<uint32_t>(value);
130610 return true;
130611}

◆ TryConvert() [9/13]

template<>
bool duckdb::Uhugeint::TryConvert ( uint64_t value,
uhugeint_t & result )
130613 {
130614 result = UhugeintConvertInteger<uint64_t>(value);
130615 return true;
130616}

◆ TryConvert() [10/13]

template<>
bool duckdb::Uhugeint::TryConvert ( uhugeint_t value,
uhugeint_t & result )
130619 {
130620 result = value;
130621 return true;
130622}

◆ TryConvert() [11/13]

template<>
bool duckdb::Uhugeint::TryConvert ( float value,
uhugeint_t & result )
130625 {
130626 return Uhugeint::TryConvert(double(value), result);
130627}

◆ TryConvert() [12/13]

template<>
bool duckdb::Uhugeint::TryConvert ( double value,
uhugeint_t & result )
130643 {
130644 return ConvertFloatingToUhugeint<double>(value, result);
130645}

◆ TryConvert() [13/13]

template<>
bool duckdb::Uhugeint::TryConvert ( long double value,
uhugeint_t & result )
130648 {
130649 return ConvertFloatingToUhugeint<long double>(value, result);
130650}

The documentation for this class was generated from the following files: