Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
335a5236
Commit
335a5236
authored
Nov 06, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add sys.float32bits, sys.float64bits
R=rsc DELTA=21 (21 added, 0 deleted, 0 changed) OCL=18709 CL=18718
parent
ce151585
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
src/cmd/gc/sys.go
src/cmd/gc/sys.go
+2
-0
src/cmd/gc/sysimport.c
src/cmd/gc/sysimport.c
+2
-0
src/runtime/runtime.c
src/runtime/runtime.c
+17
-0
No files found.
src/cmd/gc/sys.go
View file @
335a5236
...
...
@@ -49,6 +49,8 @@ export func isInf(float64, int) bool; // test for infinity
export
func
isNaN
(
float64
)
bool
;
// test for not-a-number
export
func
Inf
(
int
)
float64
;
// return signed Inf
export
func
NaN
()
float64
;
// return a NaN
export
func
float32bits
(
float32
)
uint32
;
// raw bits
export
func
float64bits
(
float64
)
uint64
;
// raw bits
export
func
newmap
(
keysize
int
,
valsize
int
,
keyalg
int
,
valalg
int
,
...
...
src/cmd/gc/sysimport.c
View file @
335a5236
...
...
@@ -39,6 +39,8 @@ char *sysimport =
"export func sys.isNaN (? float64) (? bool)
\n
"
"export func sys.Inf (? int) (? float64)
\n
"
"export func sys.NaN () (? float64)
\n
"
"export func sys.float32bits (? float32) (? uint32)
\n
"
"export func sys.float64bits (? float64) (? uint64)
\n
"
"export func sys.newmap (keysize int, valsize int, keyalg int, valalg int, hint int) (hmap *map[any] any)
\n
"
"export func sys.mapaccess1 (hmap *map[any] any, key any) (val any)
\n
"
"export func sys.mapaccess2 (hmap *map[any] any, key any) (val any, pres bool)
\n
"
...
...
src/runtime/runtime.c
View file @
335a5236
...
...
@@ -347,6 +347,23 @@ sys·NaN(float64 out)
FLUSH
(
&
out
);
}
// func float32bits(float32) uint32; // raw bits of float32
void
sys
·
float32bits
(
float32
din
,
uint32
iou
)
{
iou
=
*
(
uint32
*
)
&
din
;
FLUSH
(
&
iou
);
}
// func float64bits(float64) uint64; // raw bits of float64
void
sys
·
float64bits
(
float64
din
,
uint64
iou
)
{
iou
=
*
(
uint64
*
)
&
din
;
FLUSH
(
&
iou
);
}
static
int32
argc
;
static
uint8
**
argv
;
static
int32
envc
;
...
...
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