This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]