Ville Mattila
2/16/2006 10:06:00 AM
Yukihiro Matsumoto <matz@ruby-lang.org> writes:
> Hi,
>
> In message "Re: pack("l"), 64 bit question"
> on Thu, 16 Feb 2006 17:45:50 +0900, H.Yamamoto <ocean@m2.ccsnet.ne.jp> writes:
> |
> |>This means EXTEND32() macro in pack.c is not working on 64bit Solaris
> |>(and perhaps on other 64bit systems neither). I have no 64bit machine
> |>at hand. Could somebody confirm?
> |
> |Me neigher. But we can use HP TestDrive :-)
> |
> |Probably this patch will solve the problem.
>
> Daniel, could you try this patch on your 64bit box?
The pach works for me on my opteron 64 box. Here is another.
The sun studio cc, warned
cc: Warning: -fsimple option is ignored.
"../pack.c", line 1954: warning: integer overflow detected: op "<<"
"../pack.c", line 1954: warning: initializer does not fit or is out of range: -144115188075855872
Is the patch correct?
index: pack.c
===================================================================
RCS file: /src/ruby/pack.c,v
retrieving revision 1.62.2.12
@@ -1951,7 +1951,7 @@ pack_unpack(str, fmt)
case 'w':
{
unsigned long ul = 0;
- unsigned long ulmask = 0xfeL << ((sizeof(unsigned long) - 1) * 8);
+ unsigned long ulmask = 0xfeUL << ((sizeof(unsigned long) - 1UL) * 8UL);
while (len > 0 && s < send) {
ul <<= 7;