This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: left shift count >= width of type with constant, compile-time expression
- From: John Love-Jensen <eljay at adobe dot com>
- To: Jim Cromie <jim dot cromie at gmail dot com>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Tue, 02 May 2006 09:13:41 -0500
- Subject: Re: left shift count >= width of type with constant, compile-time expression
Hi Jim,
What happens if you try this:
#define CLKSRC_MASK(bits) ((((cycle_t)1)<<bits)-((cycle_t)1))
The way you had it, it was operating on an int, not on a cycle_t. Hence,
integer overflow.
--Eljay