Commit b6784361 by Jonathan Wakely Committed by Jonathan Wakely

Use CHAR_BIT instead of assuming 8 bits

	* src/c++11/random.cc (random_device::_M_getentropy): Use __CHAR_BIT__
	instead of fixed number of bits.

From-SVN: r248428
parent 216bfadc
2017-05-24 Jonathan Wakely <jwakely@redhat.com>
* src/c++11/random.cc (random_device::_M_getentropy): Use __CHAR_BIT__
instead of fixed number of bits.
2017-05-24 Andreas Schwab <schwab@suse.de>
* config/abi/post/ia64-linux-gnu/baseline_symbols.txt: Update.
......
......@@ -187,8 +187,9 @@ namespace std _GLIBCXX_VISIBILITY(default)
if (ent < 0)
return 0.0;
if (static_cast<unsigned>(ent) > sizeof(result_type) * 8)
return static_cast<double>(sizeof(result_type) * 8);
const int max = sizeof(result_type) * __CHAR_BIT__;
if (ent > max)
ent = max;
return static_cast<double>(ent);
#else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment