libstdc++: Expand supported operations for __rand_uint128.

This patch adds following operations to __rand_uint128:
* explicit operator bool
* operator- with __rand_uint128
* operator* with uint64_t for _M_hi != 0
* operator/ with uint64_t
The division is currently stubbed by converting to __rand_uint128.

When __rand_uint128 is used, the platform does not provide native 128bit
integer types, thus random number generators will return at most 64bit
integer. In consequence, __generate_cannonical_any will use these
overloads when multiplying by result of generator invocation.

libstdc++-v3/ChangeLog:

	* include/bits/random.h (__rand_uint128::operator bool):
	(__rand_uint128::operator-=(const type& __r))
	(__rand_uint128::operator-(type __l, const type& __r)):
	Implement.
	(__rand_uint128::operator/=(uint64_t __r))
	(__rand_uint128::operator/(type __l, uint64_t __r)):
	Define by converting to type.
	(__rand_uint128::operator*=(const type& __r)): Remove
	precondition and handle _M_hi != 0.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
1 file changed