[Bug c++/55095] Wshift-overflow

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Oct 27 18:40:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55095

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-10-27 18:39:39 UTC ---
(In reply to comment #1)
> Is there any function to compute how many bits are required to store a value?

For positive values it's easy, something like   1 + (int)log2(value)



More information about the Gcc-bugs mailing list