Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
9526f3b8
Commit
9526f3b8
authored
Feb 08, 2009
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use unsafe.Sizeof
R=rsc DELTA=9 (3 added, 3 deleted, 3 changed) OCL=24640 CL=24653
parent
8f2b774e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
type.go
src/lib/reflect/type.go
+6
-6
No files found.
src/lib/reflect/type.go
View file @
9526f3b8
...
@@ -10,6 +10,7 @@ package reflect
...
@@ -10,6 +10,7 @@ package reflect
import
(
import
(
"utf8"
;
"utf8"
;
"sync"
;
"sync"
;
"unsafe"
;
)
)
type
Type
interface
type
Type
interface
...
@@ -47,9 +48,11 @@ const (
...
@@ -47,9 +48,11 @@ const (
UintptrKind
;
UintptrKind
;
)
)
// Int is guaranteed large enough to store a size.
var
tmp_interface
interface
{}
// used just to compute sizes of these constants
var
ptrsize
int
const
(
var
interfacesize
int
ptrsize
=
unsafe
.
Sizeof
(
&
tmp_interface
);
interfacesize
=
unsafe
.
Sizeof
(
tmp_interface
);
)
var
missingString
=
"$missing$"
// syntactic name for undefined type names
var
missingString
=
"$missing$"
// syntactic name for undefined type names
var
dotDotDotString
=
"..."
var
dotDotDotString
=
"..."
...
@@ -401,9 +404,6 @@ func unlock() {
...
@@ -401,9 +404,6 @@ func unlock() {
}
}
func
init
()
{
func
init
()
{
ptrsize
=
8
;
// TODO: compute this
interfacesize
=
2
*
ptrsize
;
// TODO: compute this
lock
();
// not necessary because of init ordering but be safe.
lock
();
// not necessary because of init ordering but be safe.
types
=
make
(
map
[
string
]
Type
);
types
=
make
(
map
[
string
]
Type
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment