0

By choosing to use int32_t rather than uint32_t, you choose to cut your maximum positive value in half (correct?).

I am confused because in pset4, int32_t (type alias LONG) is used for storing the value of biHeight, biWidth, biXPelsPerMeter and biYPelsPerMeter.

Can someone explain to me why these values are not always positive? How can a height or width be negative?

1 Answer 1

0

In at least one of those cases (I'll let you discover which, it's very important in this pset), the sign of the variable (neg or pos) has a direct bearing on how the image is displayed by the computer. The sign of a variable in a structure is often used as a control feature this way. Consult the msft spec to explain these parameters.

And yes, using a signed int instead of an unsigned cuts the positive range in half, using the difference for the negative. For details, google "twos complement" notation.

It's also often the case that when one var in a structure is used in this way, the others will be made to be the same, simply to be consistent.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

1
  • thanks for pointing me in the right direction!
    – Noodlegasa
    Nov 10, 2015 at 3:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .