Messages in this thread |  | | Date | Thu, 20 Sep 2001 16:20:54 +0200 | From | Stephan von Krawczynski <> | Subject | Re: Fw: Re: [PATCH] fix page aging (2.4.9-ac12) |
| |
On Thu, 20 Sep 2001 17:03:49 +0300 Ville Herva <vherva@niksula.hut.fi> wrote:
> age - PAGE_AGE_DECL may be a 2^32-1 or so, but when you cast it back to int, > it is at most 2^31 again. It rolls over, so you get the sign bit back. > Witness: > > vherva@linux:/home/vherva>cat n.c > #define FOUR 4 > void main() > { > unsigned three = 3; > printf("%u\n", three - FOUR); > printf("%i\n", (int)(three - FOUR)); > printf("%i\n", (int)three - (int)FOUR); > } > > vherva@linux:/home/vherva>./a.out > 4294967295 > -1 > -1 > > Perhaps a lucky incidence, but it works as Daniel wrote it. (At least on > 32-bit architecture.)
Aha, you name it, and how do you find these goodies when moving the kernel over to some new hardware platform? Even wrong things have long lives (see communist block), nevertheless fate sometimes strikes back...
Regards, Stephan
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |