diff options
| author | Russ Cox <rsc@golang.org> | 2012-09-24 14:58:34 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2012-09-24 14:58:34 -0400 |
| commit | 0b08c9483f5f447083616b7b5e6ddf04edffc379 (patch) | |
| tree | 84860615deb2e8ec6854c15632b2e879deb25cf4 /src/pkg/runtime/hashmap.c | |
| parent | 5e3fb887a3a9faf6fac1cd227d4b6b66bef9225a (diff) | |
| download | go-0b08c9483f5f447083616b7b5e6ddf04edffc379.tar.xz | |
runtime: prepare for 64-bit ints
This CL makes the runtime understand that the type of
the len or cap of a map, slice, or string is 'int', not 'int32',
and it is also careful to distinguish between function arguments
and results of type 'int' vs type 'int32'.
In the runtime, the new typedefs 'intgo' and 'uintgo' refer
to Go int and uint. The C types int and uint continue to be
unavailable (cause intentional compile errors).
This CL does not change the meaning of int, but it should make
the eventual change of the meaning of int on amd64 a bit
smoother.
Update #2188.
R=iant, r, dave, remyoudompheng
CC=golang-dev
https://golang.org/cl/6551067
Diffstat (limited to 'src/pkg/runtime/hashmap.c')
| -rw-r--r-- | src/pkg/runtime/hashmap.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c index e8965a68d5..dbb944c3fe 100644 --- a/src/pkg/runtime/hashmap.c +++ b/src/pkg/runtime/hashmap.c @@ -13,7 +13,7 @@ #define CanFreeKey (1<<3) /* okay to free pointers to keys */ struct Hmap { /* a hash table; initialize with hash_init() */ - uint32 count; /* elements in table - must be first */ + uintgo count; /* elements in table - must be first */ uint8 datasize; /* amount of data to store in entry */ uint8 flag; uint8 valoff; /* offset of value in key+value data block */ @@ -728,7 +728,6 @@ hash_keyptr(Hmap *h, void *p) static int32 debug = 0; -// makemap(typ *Type, hint uint32) (hmap *map[any]any); Hmap* runtime·makemap_c(MapType *typ, int64 hint) { @@ -1152,10 +1151,10 @@ reflect·mapiterkey(struct hash_iter *it, uintptr key, bool ok) } // For reflect: -// func maplen(h map) (len int32) +// func maplen(h map) (len int) // Like len(m) in the actual language, we treat the nil map as length 0. void -reflect·maplen(Hmap *h, int32 len) +reflect·maplen(Hmap *h, intgo len) { if(h == nil) len = 0; |
