1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* pack.c: define swap16 and swap32 only if they are not

defined. OpenBSD defines these macros. [ruby-dev:22181]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-12-08 03:47:04 +00:00
parent 4baa7a3f0f
commit 64b15d9822
2 changed files with 9 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Mon Dec 8 12:44:14 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* pack.c: define swap16 and swap32 only if they are not
defined. OpenBSD defines these macros. [ruby-dev:22181]
Sun Dec 7 20:54:17 2003 Tanaka Akira <akr@m17n.org> Sun Dec 7 20:54:17 2003 Tanaka Akira <akr@m17n.org>
* ext/iconv/iconv.c (map_charset): make case sensitive. * ext/iconv/iconv.c (map_charset): make case sensitive.

4
pack.c
View file

@ -78,7 +78,9 @@ TOKEN_PASTE(swap,x)(z) \
return r; \ return r; \
} }
#ifndef swap16
#define swap16(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) #define swap16(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF))
#endif
#if SIZEOF_SHORT == 2 #if SIZEOF_SHORT == 2
#define swaps(x) swap16(x) #define swaps(x) swap16(x)
#else #else
@ -92,10 +94,12 @@ define_swapx(s,short);
#endif #endif
#endif #endif
#ifndef swap32
#define swap32(x) ((((x)&0xFF)<<24) \ #define swap32(x) ((((x)&0xFF)<<24) \
|(((x)>>24)&0xFF) \ |(((x)>>24)&0xFF) \
|(((x)&0x0000FF00)<<8) \ |(((x)&0x0000FF00)<<8) \
|(((x)&0x00FF0000)>>8) ) |(((x)&0x00FF0000)>>8) )
#endif
#if SIZEOF_LONG == 4 #if SIZEOF_LONG == 4
#define swapl(x) swap32(x) #define swapl(x) swap32(x)
#else #else