msi: Fix some copy/paste bugs in the implementation of condition operators.

Neil Skrypuch ns03ja at brocku.ca
Mon Jun 5 17:36:53 CDT 2006


On Monday, June 05, 2006 12:58, EA Durbin wrote:
> Okay what am i misunderstanding?, explain it to me as its imperative I
> learn, and I'd love to learn.
>
> %u is an unsigned integer which is 0 to +32,767.
>
>
> %i is a signed integer –32,767 to +32,767.
>
> If the sequence number is always going to be a positive number why should
> we allot it the extra 32,767 value range?

Not quite...

neil at t40-n ~ $ cat >tmp.c <<EOF
#include <stdint.h>
#include <stdio.h>

int main(void)
{
	uint16_t i = -1;

	printf("%u\n", i);

	return 0;
}
EOF
neil at t40-n ~ $ gcc tmp.c
neil at t40-n ~ $ ./a.out
65535
neil at t40-n ~ $

if you inspect the memory that's at i, you'll find it's 0xffff. If you read it 
as signed, you interpret it using two's complement[1], if you read it as 
unsigned, you still use all the bits, but there's no sign bit*.

[1] http://en.wikipedia.org/wiki/Two's_complement

* Strictly speaking it's not a sign bit, but is frequently referred to as one 
anyways.

- Neil



More information about the wine-devel mailing list