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
272ae659
Commit
272ae659
authored
Aug 10, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mp fixed arith
R=r DELTA=149 (80 added, 62 deleted, 7 changed) OCL=14029 CL=14029
parent
baf0747d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
43 deletions
+61
-43
Makefile
src/cmd/gc/Makefile
+3
-1
const.c
src/cmd/gc/const.c
+23
-13
go.h
src/cmd/gc/go.h
+33
-27
lex.c
src/cmd/gc/lex.c
+2
-2
No files found.
src/cmd/gc/Makefile
View file @
272ae659
...
...
@@ -22,7 +22,9 @@ OFILES=\
export.
$O
\
walk.
$O
\
const.
$O
\
mparith.
$O
\
mparith1.
$O
\
mparith2.
$O
\
mparith3.
$O
\
sysimport.
$O
\
compat.
$O
\
...
...
src/cmd/gc/const.c
View file @
272ae659
...
...
@@ -323,16 +323,7 @@ evconst(Node *n)
goto
settrue
;
goto
setfalse
;
}
*
n
=
*
nl
;
// second half of dance
if
(
wl
==
Wlitint
)
{
n
->
val
.
u
.
xval
=
xval
;
}
else
if
(
wl
==
Wlitfloat
)
{
n
->
val
.
u
.
fval
=
fval
;
}
return
;
goto
ret
;
settrue:
*
n
=
*
booltrue
;
...
...
@@ -343,6 +334,15 @@ setfalse:
return
;
unary:
if
(
wl
==
Wlitint
)
{
xval
=
mal
(
sizeof
(
*
xval
));
mpmovefixfix
(
xval
,
nl
->
val
.
u
.
xval
);
}
else
if
(
wl
==
Wlitfloat
)
{
fval
=
mal
(
sizeof
(
*
fval
));
mpmovefltflt
(
fval
,
nl
->
val
.
u
.
fval
);
}
switch
(
TUP
(
n
->
op
,
wl
))
{
default:
yyerror
(
"illegal combination of literals %O %d"
,
n
->
op
,
wl
);
...
...
@@ -351,16 +351,16 @@ unary:
case
TUP
(
OPLUS
,
Wlitint
):
break
;
case
TUP
(
OMINUS
,
Wlitint
):
mpnegfix
(
nl
->
val
.
u
.
xval
);
mpnegfix
(
xval
);
break
;
case
TUP
(
OCOM
,
Wlitint
):
mpcomfix
(
nl
->
val
.
u
.
xval
);
mpcomfix
(
xval
);
break
;
case
TUP
(
OPLUS
,
Wlitfloat
):
break
;
case
TUP
(
OMINUS
,
Wlitfloat
):
mpnegflt
(
nl
->
val
.
u
.
fval
);
mpnegflt
(
fval
);
break
;
case
TUP
(
ONOT
,
Wlitbool
):
...
...
@@ -368,7 +368,17 @@ unary:
goto
settrue
;
goto
setfalse
;
}
ret:
*
n
=
*
nl
;
// second half of dance
if
(
wl
==
Wlitint
)
{
n
->
val
.
u
.
xval
=
xval
;
}
else
if
(
wl
==
Wlitfloat
)
{
n
->
val
.
u
.
fval
=
fval
;
}
}
void
...
...
src/cmd/gc/go.h
View file @
272ae659
...
...
@@ -78,8 +78,6 @@ typedef struct Mpflt Mpflt;
struct
Mpflt
{
double
val
;
long
a
[
Mpprec
];
uchar
neg
;
uchar
ovf
;
};
...
...
@@ -471,46 +469,54 @@ void ungetc(int);
void
mkpackage
(
char
*
);
/*
* mparith.c
* mparith
1
.c
*/
void
mpmovefixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpmovefixflt
(
Mpflt
*
a
,
Mpint
*
b
);
void
mpmovefltfix
(
Mpint
*
a
,
Mpflt
*
b
);
void
mpmovefltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
void
mpmovecfix
(
Mpint
*
a
,
vlong
v
);
void
mpmovecflt
(
Mpflt
*
a
,
double
f
);
int
mpcmpfixfix
(
Mpint
*
a
,
Mpint
*
b
);
int
mpcmpfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
int
mpcmpfixc
(
Mpint
*
b
,
vlong
c
);
int
mpcmpfltc
(
Mpint
*
b
,
double
c
);
int
mptestfixfix
(
Mpint
*
a
);
int
mptestfltflt
(
Mpflt
*
a
);
void
mpaddfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpaddfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
int
mpcmpfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
int
mpcmpfltc
(
Mpflt
*
b
,
double
c
);
void
mpsubfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpsubfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
void
mpmulfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpmulfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
void
mpaddcfix
(
Mpint
*
a
,
vlong
c
);
void
mpaddcflt
(
Mpflt
*
a
,
double
c
);
void
mpmulcfix
(
Mpint
*
a
,
vlong
c
);
void
mpmulcflt
(
Mpflt
*
a
,
double
c
);
void
mpdivfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpdivfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
void
mpnegfix
(
Mpint
*
a
);
void
mpnegflt
(
Mpflt
*
a
);
void
mpmodfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpatofix
(
Mpint
*
a
,
char
*
s
);
void
mpatoflt
(
Mpflt
*
a
,
char
*
s
);
void
mpmovefltfix
(
Mpint
*
a
,
Mpflt
*
b
);
void
mpmovefixflt
(
Mpflt
*
a
,
Mpint
*
b
);
/*
* mparith2.c
*/
void
mpmovefixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpmovecfix
(
Mpint
*
a
,
vlong
v
);
int
mptestfix
(
Mpint
*
a
);
void
mpaddfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpmulfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpdivmodfixfix
(
Mpint
*
q
,
Mpint
*
r
,
Mpint
*
n
,
Mpint
*
d
);
void
mpnegfix
(
Mpint
*
a
);
void
mpandfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mplshfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpmodfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mporfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mprshfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpxorfixfix
(
Mpint
*
a
,
Mpint
*
b
);
void
mpcomfix
(
Mpint
*
a
);
double
mpgetflt
(
Mpflt
*
a
);
vlong
mpgetfix
(
Mpint
*
a
);
void
mpatofix
(
Mpint
*
a
,
char
*
s
);
void
mpatoflt
(
Mpflt
*
a
,
char
*
s
);
/*
* mparith3.c
*/
void
mpmovefltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
void
mpmovecflt
(
Mpflt
*
a
,
double
f
);
int
mptestflt
(
Mpflt
*
a
);
void
mpaddfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
void
mpmulfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
void
mpdivfltflt
(
Mpflt
*
a
,
Mpflt
*
b
);
void
mpnegflt
(
Mpflt
*
a
);
double
mpgetflt
(
Mpflt
*
a
);
/*
* subr.c
...
...
src/cmd/gc/lex.c
View file @
272ae659
...
...
@@ -1076,11 +1076,11 @@ lexinit(void)
mpatofix
(
minintval
[
TINT32
],
"-0x80000000"
);
mpatofix
(
maxintval
[
TINT64
],
"0x7fffffffffffffff"
);
mpatofix
(
minintval
[
TINT64
],
"-0x8000000000000000"
);
mpatofix
(
maxintval
[
TUINT8
],
"0xff"
);
mpatofix
(
maxintval
[
TUINT16
],
"0xffff"
);
mpatofix
(
maxintval
[
TUINT32
],
"0xffffffff"
);
mpatofix
(
maxintval
[
TUINT64
],
"0x7fffffffffffffff"
);
mpatofix
(
minintval
[
TUINT64
],
"-0x8000000000000000"
);
mpatofix
(
maxintval
[
TUINT64
],
"0xffffffffffffffff"
);
mpatoflt
(
maxfltval
[
TFLOAT32
],
"3.40282347e+38"
);
mpatoflt
(
minfltval
[
TFLOAT32
],
"-3.40282347e+38"
);
...
...
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