ruby-changes:14897
From: nobu <ko1@a...>
Date: Fri, 26 Feb 2010 16:52:24 +0900 (JST)
Subject: [ruby-changes:14897] Ruby:r26766 (trunk): * pack.c (swap64): fix for VC6.
nobu 2010-02-26 16:49:21 +0900 (Fri, 26 Feb 2010) New Revision: 26766 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26766 Log: * pack.c (swap64): fix for VC6. Modified files: trunk/ChangeLog trunk/pack.c Index: ChangeLog =================================================================== --- ChangeLog (revision 26765) +++ ChangeLog (revision 26766) @@ -1,3 +1,7 @@ +Fri Feb 26 16:49:29 2010 Nobuyoshi Nakada <nobu@r...> + + * pack.c (swap64): fix for VC6. + Fri Feb 26 14:17:09 2010 Nobuyoshi Nakada <nobu@r...> * pack.c (pack_pack, pack_unpack): suppressed warnings. Index: pack.c =================================================================== --- pack.c (revision 26765) +++ pack.c (revision 26766) @@ -84,24 +84,20 @@ #ifndef swap64 # if SIZEOF_LONG == 8 -# define swap64(x) ((((x)&0x00000000000000FFL)<<56) \ - |(((x)>>56)&0xFF) \ - |(((x)&0x000000000000FF00L)<<40) \ - |(((x)&0x00FF000000000000L)>>40) \ - |(((x)&0x0000000000FF0000L)<<24) \ - |(((x)&0x0000FF0000000000L)>>24) \ - |(((x)&0x00000000FF000000L)<<8) \ - |(((x)&0x000000FF00000000L)>>8)) +# define byte_in_64bit(n) ((unsigned long)0xff << n) # elif defined(HAVE_LONG_LONG) && SIZEOF_LONG_LONG == 8 -# define swap64(x) ((((x)&0x00000000000000FFLL)<<56) \ - |(((x)>>56)&0xFF) \ - |(((x)&0x000000000000FF00LL)<<40) \ - |(((x)&0x00FF000000000000LL)>>40) \ - |(((x)&0x0000000000FF0000LL)<<24) \ - |(((x)&0x0000FF0000000000LL)>>24) \ - |(((x)&0x00000000FF000000LL)<<8) \ - |(((x)&0x000000FF00000000LL)>>8)) +# define byte_in_64bit(n) ((LONG_LONG)0xff << n) # endif +# ifdef byte_in_64bit +# define swap64(x) ((((x)&byte_in_64bit(0))<<56) \ + |(((x)>>56)&0xFF) \ + |(((x)&byte_in_64bit(8))<<40) \ + |(((x)&byte_in_64bit(48))>>40) \ + |(((x)&byte_in_64bit(16))<<24) \ + |(((x)&byte_in_64bit(40))>>24) \ + |(((x)&byte_in_64bit(24))<<8) \ + |(((x)&byte_in_64bit(32))>>8)) +# endif #endif #if SIZEOF_SHORT == 2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/