mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add safe_cast (RIPD-1702):
This change ensures that no overflow can occur when casting between enums and integral types.
This commit is contained in:
committed by
Nik Bougalis
parent
494724578a
commit
148bbf4e8f
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/basics/safe_cast.h>
|
||||
#include <test/jtx/Account.h>
|
||||
#include <test/jtx/amount.h>
|
||||
#include <cassert>
|
||||
@@ -119,7 +120,7 @@ PrettyAmount
|
||||
IOU::operator()(detail::epsilon_multiple m) const
|
||||
{
|
||||
return { STAmount(issue(),
|
||||
static_cast<std::uint64_t>(m.n), -81),
|
||||
safe_cast<std::uint64_t>(m.n), -81),
|
||||
account.name() };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user