rdrand: silence a type conversion warning under clang
This commit is contained in:
parent
2d9a7109b1
commit
e723684347
@ -40,5 +40,9 @@ rdrand::operator() ()
|
|||||||
if (!__builtin_expect(success, 1))
|
if (!__builtin_expect(success, 1))
|
||||||
throw std::runtime_error ("no value available for rdrand");
|
throw std::runtime_error ("no value available for rdrand");
|
||||||
|
|
||||||
return res;
|
// As long as the u64 we just grabbed is of a type we can truncate then
|
||||||
|
// we'll do just that and return it.
|
||||||
|
static_assert (sizeof (result_type) <= sizeof (res));
|
||||||
|
static_assert (std::is_signed_v<result_type> == std::is_signed_v<decltype(res)>);
|
||||||
|
return static_cast<result_type> (res);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user