Hello,

I did search around and there are few examples about this situation (not much as I would have expected though), but I want to know the procedure or how to find the solution.

Basically I have a 32-bit UNSIGNED register. I want to know how to calculate the value when I subtract 1 when the value is zero (all zero bits).

Cheers.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by m26k9

Basically I have a 32-bit UNSIGNED register. I want to know how to calculate the value when I subtract 1 when the value is zero (all zero bits).

So you have 32 bits of 0. Assume for argument's sake there is a 1 in the next bit (bit 33). Subtract 1. What do you get?

That's how you figure it out.

The easy way is to simply know that if you have all 0s, when you subtract 1 you get all 1s. Doesn't matter if the value is signed or unsigned.

Thank you very much WaltP.
So when I subtract 1 from an all zero register it goes to its highest value.

Cheers.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.