62 lines
1.7 KiB
Diff
62 lines
1.7 KiB
Diff
diff --git core/array_map.go core/array_map.go
|
|
index 3d9b95d..6e03cfa 100644
|
|
--- core/array_map.go
|
|
+++ core/array_map.go
|
|
@@ -21,7 +21,7 @@ type (
|
|
)
|
|
|
|
var (
|
|
- HASHMAP_THRESHOLD int = 16
|
|
+ HASHMAP_THRESHOLD int64 = 16
|
|
)
|
|
|
|
func EmptyArrayMap() *ArrayMap {
|
|
@@ -169,7 +169,7 @@ func (m *ArrayMap) Assoc(key Object, value Object) Associative {
|
|
res.arr[i+1] = value
|
|
return res
|
|
}
|
|
- if len(m.arr) >= HASHMAP_THRESHOLD {
|
|
+ if int64(len(m.arr)) >= HASHMAP_THRESHOLD {
|
|
return NewHashMap(m.arr...).Assoc(key, value)
|
|
}
|
|
res := m.Clone()
|
|
diff --git core/eval.go core/eval.go
|
|
index 42b7ff2..49ade93 100644
|
|
--- core/eval.go
|
|
+++ core/eval.go
|
|
@@ -204,7 +204,7 @@ func (expr *VectorExpr) Eval(env *LocalEnv) Object {
|
|
}
|
|
|
|
func (expr *MapExpr) Eval(env *LocalEnv) Object {
|
|
- if len(expr.keys) > HASHMAP_THRESHOLD/2 {
|
|
+ if int64(len(expr.keys)) > HASHMAP_THRESHOLD/2 {
|
|
res := EmptyHashMap
|
|
for i := range expr.keys {
|
|
key := Eval(expr.keys[i], env)
|
|
diff --git core/read.go core/read.go
|
|
index 199fd72..1a03ca8 100644
|
|
--- core/read.go
|
|
+++ core/read.go
|
|
@@ -604,7 +604,7 @@ func readMapWithNamespace(reader *Reader, nsname string) Object {
|
|
if len(objs)%2 != 0 {
|
|
panic(MakeReadError(reader, "Map literal must contain an even number of forms"))
|
|
}
|
|
- if len(objs) > HASHMAP_THRESHOLD {
|
|
+ if int64(len(objs)) >= HASHMAP_THRESHOLD {
|
|
hashMap := NewHashMap()
|
|
for i := 0; i < len(objs); i += 2 {
|
|
key := resolveKey(objs[i], nsname)
|
|
diff --git main.go main.go
|
|
index 126f221..bfd1b84 100644
|
|
--- main.go
|
|
+++ main.go
|
|
@@ -437,7 +437,7 @@ func parseArgs(args []string) {
|
|
if thresh < 0 {
|
|
HASHMAP_THRESHOLD = math.MaxInt64
|
|
} else {
|
|
- HASHMAP_THRESHOLD = thresh
|
|
+ HASHMAP_THRESHOLD = int64(thresh)
|
|
}
|
|
} else {
|
|
missing = true
|