In reply to Deepak Muduli:
Your problem is a is unsigned, so the entire expression is evaluated unsigned. Your cast to an int fixes that.
In reply to Deepak Muduli:
Your problem is a is unsigned, so the entire expression is evaluated unsigned. Your cast to an int fixes that.