This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

fix off-by-one in transient map keyword lookup

  • Loading branch information...
ztellman committed Sep 3, 2014
1 parent d5ab875 commit eb7dfe6d12e6774512dbab22a148202052442c6d
@@ -195,27 +195,27 @@ private int indexOf(int h, Object key) {
switch (6 - count) {
case 0:
if (k5 == key) {
return 6;
return 5;
}
case 1:
if (k4 == key) {
return 5;
return 4;
}
case 2:
if (k3 == key) {
return 4;
return 3;
}
case 3:
if (k2 == key) {
return 3;
return 2;
}
case 4:
if (k1 == key) {
return 2;
return 1;
}
case 5:
if (k0 == key) {
return 1;
return 0;
}
default:
return -1;
@@ -556,7 +556,7 @@
(fn [idx k]
[idx
(j/cond (str k "== key")
(j/return (- max-cardinality idx)))])
(j/return (- max-cardinality idx 1)))])
(range)
(reverse ks))
[(j/return -1)])))
View
@@ -13,7 +13,7 @@
[org.jibx.config.3rdparty.org.eclipse/org.eclipse.text "3.5.100.v20110505-0800"]
[org.jibx.config.3rdparty.org.eclipse/org.eclipse.core.resources "3.7.100.v20110510-0712"]
[org.jibx.config.3rdparty.org.eclipse/org.eclipse.equinox.common "3.6.0.v20110523"]]
:jvm-opts ["-server"]
:jvm-opts ["-server" "-Xmx2g"]
:test-selectors {:default (complement :benchmark)
:benchmark :benchmark}
:main cambrian-collections.main
@@ -15,7 +15,15 @@
(declare unrolled)
(deftest test-map-like
(check/assert-map-like 1e4 (unrolled) gen/int gen/int))
(check/assert-map-like 1e4 (unrolled) gen/int gen/int)
#_(check/assert-map-like 1e3 (unrolled) gen/any gen/int)
(check/assert-map-like 1e3 (unrolled)
(gen/one-of (->> (range (int \a) (int \z))
(map char)
(map str)
(map keyword)
(map gen/return)))
gen/int))
#_(deftest test-print-dup
(binding [*print-dup* true]

0 comments on commit eb7dfe6

Please sign in to comment.