summaryrefslogtreecommitdiffstats
path: root/pack.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-06 14:00:54 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-01-06 14:00:54 +0000
commitb5f72bc6cb12301a5bc0dfdaf54d1d3d23c7948d (patch)
tree3377751600ae0fbdebe4a5f234604853f9c3c394 /pack.c
parent6608596896a8acf92401fdb2530d16b93f2ffd90 (diff)
downloadruby-b5f72bc6cb12301a5bc0dfdaf54d1d3d23c7948d.tar.gz
ruby-b5f72bc6cb12301a5bc0dfdaf54d1d3d23c7948d.tar.xz
ruby-b5f72bc6cb12301a5bc0dfdaf54d1d3d23c7948d.zip
* eval.c (rb_mod_modfunc): should break if m has no super class.
[ruby-dev:22498] * backport changes from 1.9 git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@5391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/pack.c b/pack.c
index 4763c81c2..4edffd380 100644
--- a/pack.c
+++ b/pack.c
@@ -22,12 +22,14 @@
#endif
#ifdef NATINT_PACK
+# define OFF16B(p) ((char*)(p) + (natint?0:(sizeof(short) - SIZE16)))
+# define OFF32B(p) ((char*)(p) + (natint?0:(sizeof(long) - SIZE32)))
# define NATINT_I32(x) (natint?NUM2LONG(x):(NUM2I32(x)))
# define NATINT_U32(x) (natint?NUM2ULONG(x):(NUM2U32(x)))
# define NATINT_LEN(type,len) (natint?sizeof(type):(len))
# ifdef WORDS_BIGENDIAN
-# define OFF16(p) ((char*)(p) + (natint?0:(sizeof(short) - SIZE16)))
-# define OFF32(p) ((char*)(p) + (natint?0:(sizeof(long) - SIZE32)))
+# define OFF16(p) OFF16B(p)
+# define OFF32(p) OFF32B(p)
# endif
# define NATINT_HTOVS(x) (natint?htovs(x):htov16(x))
# define NATINT_HTOVL(x) (natint?htovl(x):htov32(x))
@@ -47,6 +49,10 @@
# define OFF16(p) (char*)(p)
# define OFF32(p) (char*)(p)
#endif
+#ifndef OFF16B
+# define OFF16B(p) (char*)(p)
+# define OFF32B(p) (char*)(p)
+#endif
#define define_swapx(x, xtype) \
static xtype \
@@ -1648,7 +1654,7 @@ pack_unpack(str, fmt)
PACK_LENGTH_ADJUST(unsigned short,2);
while (len-- > 0) {
unsigned short tmp = 0;
- memcpy(OFF16(&tmp), s, NATINT_LEN(unsigned short,2));
+ memcpy(OFF16B(&tmp), s, NATINT_LEN(unsigned short,2));
s += NATINT_LEN(unsigned short,2);
rb_ary_push(ary, UINT2NUM(ntohs(tmp)));
}
@@ -1659,7 +1665,7 @@ pack_unpack(str, fmt)
PACK_LENGTH_ADJUST(unsigned long,4);
while (len-- > 0) {
unsigned long tmp = 0;
- memcpy(OFF32(&tmp), s, NATINT_LEN(unsigned long,4));
+ memcpy(OFF32B(&tmp), s, NATINT_LEN(unsigned long,4));
s += NATINT_LEN(unsigned long,4);
rb_ary_push(ary, ULONG2NUM(ntohl(tmp)));
}