diff options
author | buraq <buraq@epfl.ch> | 2003-11-25 14:55:29 +0000 |
---|---|---|
committer | buraq <buraq@epfl.ch> | 2003-11-25 14:55:29 +0000 |
commit | d4acacd8bfde1983950854c1862a75e54bfc5c27 (patch) | |
tree | 6613fa8a129c8aefa596bfc4cc25d5e3d7a47a5e | |
parent | 6289ffbd9182453349334f4e609e2f4da7d2fe44 (diff) | |
download | scala-d4acacd8bfde1983950854c1862a75e54bfc5c27.tar.gz scala-d4acacd8bfde1983950854c1862a75e54bfc5c27.tar.bz2 scala-d4acacd8bfde1983950854c1862a75e54bfc5c27.zip |
fixed error in pow!
-rw-r--r-- | sources/scala/collection/immutable/Tree.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sources/scala/collection/immutable/Tree.scala b/sources/scala/collection/immutable/Tree.scala index 96509161b7..0f1b715512 100644 --- a/sources/scala/collection/immutable/Tree.scala +++ b/sources/scala/collection/immutable/Tree.scala @@ -264,9 +264,10 @@ class Tree[KEY,Entry](order:Order[KEY],entryKey:Entry=>KEY) { */ protected val p = 2; // It seems that p = 2 is optimal for sorted keys */ protected def pow(a:int, b:int):int = - a.match { + b.match { case 2 => a * a; case 1 => a; + case 0 => 1; case x if x > 0 => a * pow(a, b-1); }; private def div2(x:int) = x >> 1; |