From: Janne H. <ja...@hy...> - 2004-12-22 22:00:47
|
Here is a patch that should fix BitSet.compare bugs. I made a relatively extensive tester for it and couldn't find any problems. The compare now works as if the bitvector was a BigInt. I am guessing that that has been the original intent as well. Perhaps someone can take a look before I commit the changes? ciao, janne > Compare seems completely broken to me too, at least if one > expects it to work like you suggest (which is IMHO the > correct way). > > It doesn't seem to properly account for the two bitsets > possibly being of different lengths, it just starts > comparing at the MSB even if the difference between the > lengths of the sets is more than a byte. It gets more > complicated because you can't even use |t1|>|t2| as an > indication that t1>t2, because there is AFAICT no > guarantee that the leading bit (or even just one bit in > the first byte of the representation!) is set. |