>> On Mon, 11 Nov 2002 08:55:02 -0500 (EST), Thomas David Rivers <[EMAIL PROTECTED]> >said:
Th> Several people have pointed out that using "volatile" will Th> help with your code. Th> But - even with the use of "volatile" - your code is invalid ANSI Th> C. --snip-- Thanks for your detailed explanation. It cleared me more. Th> Your code appears to simply want to swap the two (assumed) words in Th> an integer. That could be accomplished with shifts, etc... Th> This code makes all kinds of assumptions about the size of Th> `int' and `short' - but represents an alternative approach: Th> unsigned int t; Th> unsigned int x; Th> t = (x & 0xffff) << 16; Th> x >>= 16; Th> x |= t; Th> Assuming `int' was 32-bits wide - this, or something similar, Th> might be a more portable approach. Yes, I agree with your example code. But unfortunately, that ugly code was contained in our inhouse library written by someone. It took me two days to debug and find out where difference comes from between gcc-2.95.4 and gcc-3.2.1. -- TOMITA Yoshinori To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message