classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patches to java.util.zip by Christian Schlichtherle


From: Per Bothner
Subject: Re: Patches to java.util.zip by Christian Schlichtherle
Date: Wed, 31 Aug 2005 07:10:25 -0700
User-agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720)

Christian Schlichtherle wrote:
More specifically, the size and compressed size field in the ZipEntry class
are causing the problems as some comparisons are happening on these. The
issue is that once a big integer equal or greater than 2*1024^3 and smaller
than 4*1024^3 is stored into a Java int, it is hard to use this int as if it
were unsigned. You would have to do something like this on an int
(untested):

...

This is way too much computational overhead

To compare two unsigned ints just invert their sign bits:

I.e. (using C syntax):
unsigned int32 i, j;
signed int32 is = (signed int32) i;
signed int32 js = (signed int32) j;

Then (i COMP j) if and only if
((signed int32) (is ^ 0x800000) COMP (signed int32) (js & 0x80000000)).

Which is probably faster than:
((long) (is & 0xFFFFFFFF) COMP (long) (js & 0xFFFFFFFF))
--
        --Per Bothner
address@hidden   http://per.bothner.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]