mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-20 10:35:50 +00:00
Fix undefined behavior
This commit is contained in:
committed by
Nik Bougalis
parent
91ce7807b9
commit
7f5f73887d
@@ -204,10 +204,15 @@ public:
|
||||
base_uint& operator= (std::uint64_t uHost)
|
||||
{
|
||||
*this = beast::zero;
|
||||
|
||||
union
|
||||
{
|
||||
unsigned u[2];
|
||||
std::uint64_t ul;
|
||||
};
|
||||
// Put in least significant bits.
|
||||
((std::uint64_t*) end ())[-1] = htobe64 (uHost);
|
||||
|
||||
ul = htobe64 (uHost);
|
||||
pn[WIDTH-2] = u[0];
|
||||
pn[WIDTH-1] = u[1];
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user