diff --git a/cpp/ChainedHashTable.h b/cpp/ChainedHashTable.h index e2591b36..65caa3ef 100644 --- a/cpp/ChainedHashTable.h +++ b/cpp/ChainedHashTable.h @@ -48,7 +48,7 @@ template void ChainedHashTable::resize() { d = 1; while (1< newTable(1<::set(int i, T x) { template void DLList::add(int i, T x) { - addBefore(getNode(i), x); + addBefore(getNode(i), x); } template diff --git a/cpp/RootishArrayStack.h b/cpp/RootishArrayStack.h index a239102d..f7deddc2 100644 --- a/cpp/RootishArrayStack.h +++ b/cpp/RootishArrayStack.h @@ -41,25 +41,25 @@ int RootishArrayStack::size() { template inline T RootishArrayStack::get(int i) { - int b = i2b(i); - int j = i - b*(b+1)/2; - return blocks.get(b)[j]; + int b = i2b(i); + int j = i - b*(b+1)/2; + return blocks.get(b)[j]; } template inline T RootishArrayStack::set(int i, T x) { - int b = i2b(i); - int j = i - b*(b+1)/2; - T y = blocks.get(b)[j]; - blocks.get(b)[j] = x; - return y; + int b = i2b(i); + int j = i - b*(b+1)/2; + T y = blocks.get(b)[j]; + blocks.get(b)[j] = x; + return y; } template inline int RootishArrayStack::i2b(int i) { - double db = (-3.0 + sqrt(9 + 8*i)) / 2.0; - int b = (int)ceil(db); - return b; + double db = (-3.0 + sqrt(9 + 8*i)) / 2.0; + int b = (int)ceil(db); + return b; } template @@ -73,28 +73,28 @@ RootishArrayStack::~RootishArrayStack() { template void RootishArrayStack::add(int i, T x) { - int r = blocks.size(); - if (r*(r+1)/2 < n + 1) grow(); - n++; - for (int j = n-1; j > i; j--) - set(j, get(j-1)); - set(i, x); + int r = blocks.size(); + if (r*(r+1)/2 < n + 1) grow(); + n++; + for (int j = n-1; j > i; j--) + set(j, get(j-1)); + set(i, x); } template T RootishArrayStack::remove(int i) { - T x = get(i); - for (int j = i; j < n-1; j++) - set(j, get(j+1)); - n--; - int r = blocks.size(); - if ((r-2)*(r-1)/2 >= n) shrink(); - return x; + T x = get(i); + for (int j = i; j < n-1; j++) + set(j, get(j+1)); + n--; + int r = blocks.size(); + if ((r-2)*(r-1)/2 >= n) shrink(); + return x; } template void RootishArrayStack::grow() { - blocks.add(blocks.size(), new T[blocks.size()+1]); + blocks.add(blocks.size(), new T[blocks.size()+1]); } template diff --git a/latex/snarf-cpp.pl b/latex/snarf-cpp.pl index 5dc825da..2344b9f7 100755 --- a/latex/snarf-cpp.pl +++ b/latex/snarf-cpp.pl @@ -113,7 +113,7 @@ ($$) # external function definition my $sig = methodSig($2, $3); # print(STDERR "$line - $sig"); - if (wanted($sig, @params)) { $print = $d; } + if (wanted($sig, @params)) { $print = $d; $indent = "\t"; } } elsif ($d == $d0+1 && $inclass == 1 && $line =~ /^\s*$type\s+(\&|\*)*(\w+).*;.*/) { # instance or class variable declaration if (wanted($3, @params)) {