mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 13:03:39 +00:00
compiler,runtime: implement maps for arbitrary keys
This implementation simply casts types without special support to an interface, to make the implementation simpler and possibly reducing the code size too. It will likely be slower than the canonical Go implementation though (which builds special compare and hash functions at compile time).
This commit is contained in:
committed by
Ron Evans
parent
440dc8ed4e
commit
0d34f933eb
Vendored
+15
@@ -54,5 +54,20 @@ true false 0
|
||||
42
|
||||
4321
|
||||
5555
|
||||
itfMap[3]: 0
|
||||
itfMap[3.14]: 3
|
||||
itfMap[8]: 8
|
||||
itfMap[uint8(8)]: 80
|
||||
itfMap["eight"]: 800
|
||||
itfMap[[2]int{5, 2}]: 52
|
||||
itfMap[true]: 1
|
||||
itfMap[8]: 0
|
||||
floatMap[42]: 84
|
||||
floatMap[43]: 0
|
||||
floatMap[42]: 0
|
||||
structMap[{"tau", 6.28}]: 5
|
||||
structMap[{"Tau", 6.28}]: 0
|
||||
structMap[{"tau", 3.14}]: 0
|
||||
structMap[{"tau", 6.28}]: 0
|
||||
tested preallocated map
|
||||
tested growing of a map
|
||||
|
||||
Reference in New Issue
Block a user