Dear all,
My compiler throw a waring "warning: #61-D: integer operation result is out of range" but I think is a bug of the compiler because it have no sense. This is the warning line:
GPIOB->CRL &= ~(0xF << (7 * 4))
0xF << 28 times is in the range of the CRL register... can anybody tell me the reason of this?
Thanks for all
Note that 0x0f as a signed 32-bit number will change sign if shifted left 28 steps.
So there is actually the question if the warning really does lack sense. Or if you have forgotten to tell the compiler that you want 0x0f to be an unsigned number.
Hi,,
Thanks for your reply, I think I need to "say" to the compiler this is an unsigned value.. don't know why asume this is unsigned...
Can you recommend a solution?
Thanks
GPIOB->CRL &= ~((uint)0xF << (7 * 4))
was enought...
Thanks!!
You can write it prettier:
GPIOB->CRL &= ~(0xFU << (7 * 4))
Hi,
Thanks a lot, yes, better with "U".
I think I will remove this post because "bug" in the summary is not good for keil... Don't know if I can remove this.
No, you can't remove it.
But dont' worry. This forum is full of "bug" threads ;)
And yes - it is good practice to think about your data types and consider using u after numbers when you want unsigned arithmetic.
I think I will remove this post because "bug" in the summary is not good for keil at least, as opposed to many, you did put a question mark after 'bug'
Erik
hehe... of course, is more probable that the supossed bug is a error in my code instead of bug...
It certainly is: www.catb.org/.../smart-questions.html