mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
javadoc
This commit is contained in:
@@ -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() {
|
||||
|
||||
+4
-4
@@ -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<N;i++) {
|
||||
assertEquals(0, bitSet.get(i));
|
||||
assertEquals(0, bitSet.get(i) & 0xf);
|
||||
bitSet.set(i, 0xa);
|
||||
assertEquals(0xa, bitSet.get(i));
|
||||
assertEquals(0xa, bitSet.get(i) & 0xf);
|
||||
bitSet.set(i, 0x2);
|
||||
assertEquals(0x2, bitSet.get(i));
|
||||
assertEquals(0x2, bitSet.get(i) & 0xf);
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user