Hey All,
So I’ve found what I believe to be a bug in BigInt class, but it may be specced this way. Basically, trying to initialize a BigInt with a hex FString gives me unexpected results when value of hex string is larger than 65,535.
following code:
TBigInt<128> int128_1("ffff");
TBigInt<128> int128_2("10000");
UE_LOG(LogTemp, Warning, TEXT("%s"), *int128_1.ToString());
UE_LOG(LogTemp, Warning, TEXT("%s"), *int128_2.ToString());
Produces output:
LogTemp:Warning: 0x0000ffff
LogTemp:Warning: 0x0000000100000000
Meaning that for values up to and including 65,535 (u16 max), this constructor works, but for any values past that, starting with 65,536, constructor initializes BigInt to 4,294,967,296 (u32 max). If this is intended behavior please let me know, because I need to be able to serialize these numbers in and out of a text file. Storing them as hex values works fine until they get larger than 65535. So if this is intended, I need to either write functionality into this class, write my own, or go with GMP.
Thanks!
Branden Turner