Update of /cvsroot/nice/Nice/src/mlsub/typing/lowlevel
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6961/F:/nice/src/mlsub/typing/lowlevel
Modified Files:
BitVector.java
Log Message:
Reapplied a part of the optimizations of cvs version 1.5
Index: BitVector.java
===================================================================
RCS file: /cvsroot/nice/Nice/src/mlsub/typing/lowlevel/BitVector.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** BitVector.java 26 Mar 2004 16:03:19 -0000 1.9
--- BitVector.java 17 Apr 2004 17:12:11 -0000 1.10
***************
*** 359,365 ****
n = bits2length;
}
! int bits3length = S3.length();
! for (int i = 0; i < n; i++) {
! andW(i, ~(S1.getW(i) & S2.getW(i)) | (i < bits3length ? S3.getW(i) : 0L));
}
}
--- 359,379 ----
n = bits2length;
}
!
! if (n<=1)
! {
! andW(0, ~(S1.getW(0) & S2.getW(0)) | S3.getW(0));
! }
! else
! {
! int bits3length = S3.length();
! if (bits3length > n) {
! bits3length = n;
! }
!
! for (int i = 0; i < bits3length; i++)
! bits1[i] &= ~(S1.bits1[i] & S2.bits1[i]) | S3.getW(i);
!
! for (int i = bits3length; i < n; i++)
! bits1[i] &= ~(S1.bits1[i] & S2.bits1[i]);
}
}
***************
*** 373,381 ****
}
int setLength = set.nonZeroLength();
! if (setLength > 0) {
! ensureCapacity(bitIndex(setLength-1));// this might cause some problem...
}
! for (int i = setLength; i-- > 0 ;) {
! orW(i, set.getW(i));
}
}
--- 387,399 ----
}
int setLength = set.nonZeroLength();
! if (setLength > 1) {
! ensureCapacity(bitIndex(setLength-1));
! for (int i = setLength; i-- > 0 ;) {
! bits1[i] |= set.bits1[i];
! }
}
! else
! {
! orW(0, set.getW(0));
}
}
***************
*** 591,606 ****
static /* XXX: work around Symantec JIT bug: comment static */
int chunkLowestSetBit(long chunk) {
! if (chunk == 0L) {
! return 64;
! } else {
! int bit = 0;
! if ((chunk & 0xffffffffL) == 0) { bit += 32; chunk >>>= 32; }
! if ((chunk & 0xffffL) == 0) { bit += 16; chunk >>>= 16; }
! if ((chunk & 0xffL) == 0) { bit += 8; chunk >>>= 8; }
! if ((chunk & 0xfL) == 0) { bit += 4; chunk >>>= 4; }
! if ((chunk & 0x3L) == 0) { bit += 2; chunk >>>= 2; }
! if ((chunk & 0x1L) == 0) { bit++; }
! return bit;
! }
}
--- 609,621 ----
static /* XXX: work around Symantec JIT bug: comment static */
int chunkLowestSetBit(long chunk) {
! int bit = 0;
! chunk &= -chunk; //fix sign bit
! if ((chunk & 0xffffffff00000000L) != 0 ) bit += 32;
! if ((chunk & 0xffff0000ffff0000L) != 0 ) bit += 16;
! if ((chunk & 0xff00ff00ff00ff00L) != 0 ) bit += 8;
! if ((chunk & 0xf0f0f0f0f0f0f0f0L) != 0 ) bit += 4;
! if ((chunk & 0xccccccccccccccccL) != 0 ) bit += 2;
! if ((chunk & 0xaaaaaaaaaaaaaaaaL) != 0 ) bit += 1;
! return bit;
}
***************
*** 612,620 ****
**/
final public int getLowestSetBit() {
! int n = length();
! for (int i = 0; i < n; i++) {
! long chunk = getW(i);
! if (chunk != 0L) {
! return (i << BITS_PER_UNIT) + chunkLowestSetBit(chunk);
}
}
--- 627,642 ----
**/
final public int getLowestSetBit() {
! if (bits1 == null)
! {
! if (bits0 != 0L)
! return chunkLowestSetBit(bits0);
! }
! else
! {
! int n = bits1.length;
! for (int i = 0; i < n; i++) {
! long chunk = bits1[i];
! if (chunk != 0L)
! return (i << BITS_PER_UNIT) + chunkLowestSetBit(chunk);
}
}
***************
*** 658,662 ****
return UNDEFINED_INDEX;
}
! chunk = getW(i);
}
}
--- 680,684 ----
return UNDEFINED_INDEX;
}
! chunk = bits1[i];
}
}
***************
*** 668,677 ****
**/
public int getNextBit(int i) {
! int result = getLowestSetBit(i + 1);
! if (result < 0) {
! return UNDEFINED_INDEX;
! } else {
! return result;
! }
}
--- 690,694 ----
**/
public int getNextBit(int i) {
! return getLowestSetBit(i + 1);
}
|