diff --git a/platform/util/src/com/intellij/util/containers/ConcurrentPackedBitsArray.java b/platform/util/src/com/intellij/util/containers/ConcurrentPackedBitsArray.java index 57f0dd6a1484..f7facc262c3b 100644 --- a/platform/util/src/com/intellij/util/containers/ConcurrentPackedBitsArray.java +++ b/platform/util/src/com/intellij/util/containers/ConcurrentPackedBitsArray.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,11 +37,14 @@ public class ConcurrentPackedBitsArray { chunksPerWord = 64 / bitsPerChunk; } - // returns chunk bits + /** + * returns {@link #bitsPerChunk} bits stored at the offset "id" + * The returned bits are LSB, other (64-bitsPerChunk) higher bits are undefined + */ public long get(int id) { int bitIndex = id/chunksPerWord * 64 + (id%chunksPerWord)*bitsPerChunk; long word = bits.getWord(bitIndex) >> bitIndex; - return word & mask; + return word; } // stores chunk atomically, returns previous chunk @@ -58,7 +61,7 @@ public class ConcurrentPackedBitsArray { } }) >> bitIndex; - return prevChunk & mask; + return prevChunk; } public void clear() { diff --git a/platform/util/testSrc/com/intellij/util/containers/ConcurrentPackedBitArrayTest.java b/platform/util/testSrc/com/intellij/util/containers/ConcurrentPackedBitArrayTest.java index d5bc82baba07..cfd1619ad4df 100644 --- a/platform/util/testSrc/com/intellij/util/containers/ConcurrentPackedBitArrayTest.java +++ b/platform/util/testSrc/com/intellij/util/containers/ConcurrentPackedBitArrayTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,11 +22,11 @@ public class ConcurrentPackedBitArrayTest extends TestCase { ConcurrentPackedBitsArray bitSet = new ConcurrentPackedBitsArray(4); int N = 3000; for (int i=0; i