aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/datastructures/linkedlists/array-template22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/datastructures/linkedlists/array-template b/src/datastructures/linkedlists/array-template
index 5fce858..bee7e01 100644
--- a/src/datastructures/linkedlists/array-template
+++ b/src/datastructures/linkedlists/array-template
@@ -53,11 +53,11 @@ public class £{name}<T>
/* Most be a power of 2 */
if ((initialCapacity & initialCapacity - 1) != 0)
{
- initialCapacity >>= 1;
- initialCapacity >>= 2;
- initialCapacity >>= 4;
- initialCapacity >>= 8;
- initialCapacity >>= 16;
+ initialCapacity |= initialCapacity >> 1;
+ initialCapacity |= initialCapacity >> 2;
+ initialCapacity |= initialCapacity >> 4;
+ initialCapacity |= initialCapacity >> 8;
+ initialCapacity |= initialCapacity >> 16;
initialCapacity++;
}
@@ -148,11 +148,11 @@ public class £{name}<T>
int cap = size;
if ((cap & cap - 1) != 0)
{
- cap >>= 1;
- cap >>= 2;
- cap >>= 4;
- cap >>= 8;
- cap >>= 16;
+ cap |= cap >> 1;
+ cap |= cap >> 2;
+ cap |= cap >> 4;
+ cap |= cap >> 8;
+ cap |= cap >> 16;
cap++;
}
@@ -213,7 +213,7 @@ public class £{name}<T>
return this.reusable[--this.reuseHead];
if (this.end == this.capacity)
{
- this.capacity >>= 1;
+ this.capacity <<= 1;
System.arraycopy(this.values, 0, this.values = (T[])(new Object[this.capacity]), 0, this.end);
System.arraycopy(this.reusable, 0, this.reusable = new int[this.capacity], 0, this.end);
System.arraycopy(this.next, 0, this.next = new int[this.capacity], 0, this.end);