mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
LibCrypto: Add a constructor to (Un)SignedBigInteger taking a double
For now this will assume that the double given is exactly representable as an integer, so no NaN, infinity or rounding.
This commit is contained in:
parent
c87d10365b
commit
528891bf69
5 changed files with 161 additions and 8 deletions
|
@ -11,6 +11,12 @@
|
|||
|
||||
namespace Crypto {
|
||||
|
||||
SignedBigInteger::SignedBigInteger(double value)
|
||||
: m_sign(value < 0.0)
|
||||
, m_unsigned_data(fabs(value))
|
||||
{
|
||||
}
|
||||
|
||||
SignedBigInteger SignedBigInteger::import_data(u8 const* ptr, size_t length)
|
||||
{
|
||||
bool sign = *ptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue