Skip to content

Commit

Permalink
cmd/internal/gc: remove dead code
Browse files Browse the repository at this point in the history
Change-Id: I6b49ca1b7ee39d138aafad5875767ce93a6344f3
Reviewed-on: https://go-review.googlesource.com/7851
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
  • Loading branch information
griesemer committed Mar 20, 2015
1 parent 888767f commit 69b2f70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 331 deletions.
153 changes: 2 additions & 151 deletions src/cmd/internal/gc/mparith1.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,10 @@ func Mpcmpfixfix(a, b *Mpint) int {
return a.Val.Cmp(&b.Val)
}

func _Mpcmpfixfix(a *Mpfix, b *Mpfix) int {
var c Mpfix

_mpmovefixfix(&c, a)
_mpsubfixfix(&c, b)
return mptestfix(&c)
}

func mpcmpfixc(b *Mpint, c int64) int {
return b.Val.Cmp(big.NewInt(c))
}

func _mpcmpfixc(b *Mpfix, c int64) int {
var c1 Mpfix

_Mpmovecfix(&c1, c)
return _Mpcmpfixfix(b, &c1)
}

func mpcmpfltflt(a *Mpflt, b *Mpflt) int {
var c Mpflt

Expand Down Expand Up @@ -220,6 +205,8 @@ func _Mpmovefixflt(a *Mpflt, b *Mpfix) {
mpnorm(a)
}

// convert (truncate) b to a.
// return -1 (but still convert) if b was non-integer.
func mpexactfltfix(a *Mpint, b *Mpflt) int {
mpmovefixint(a, &b.Val) // *a = b.Val
Mpshiftfix(a, int(b.Exp))
Expand All @@ -236,24 +223,6 @@ func mpexactfltfix(a *Mpint, b *Mpflt) int {
return 0
}

// convert (truncate) b to a.
// return -1 (but still convert) if b was non-integer.
func _mpexactfltfix(a *Mpfix, b *Mpflt) int {
*a = b.Val
_Mpshiftfix(a, int(b.Exp))
if b.Exp < 0 {
var f Mpflt
f.Val = *a
f.Exp = 0
mpnorm(&f)
if mpcmpfltflt(b, &f) != 0 {
return -1
}
}

return 0
}

func mpmovefltfix(a *Mpint, b *Mpflt) int {
if mpexactfltfix(a, b) == 0 {
return 0
Expand Down Expand Up @@ -284,36 +253,6 @@ func mpmovefltfix(a *Mpint, b *Mpflt) int {
return -1
}

func _mpmovefltfix(a *Mpfix, b *Mpflt) int {
if _mpexactfltfix(a, b) == 0 {
return 0
}

// try rounding down a little
f := *b

f.Val.A[0] = 0
if _mpexactfltfix(a, &f) == 0 {
return 0
}

// try rounding up a little
for i := 1; i < Mpprec; i++ {
f.Val.A[i]++
if f.Val.A[i] != Mpbase {
break
}
f.Val.A[i] = 0
}

mpnorm(&f)
if _mpexactfltfix(a, &f) == 0 {
return 0
}

return -1
}

func mpmovefixfix(a, b *Mpint) {
a.Val.Set(&b.Val)
}
Expand Down Expand Up @@ -606,94 +545,6 @@ func mpatofix(a *Mpint, as string) {
}
}

//
// fixed point input
// required syntax is [+-][0[x]]d*
//
func _mpatofix(a *Mpfix, as string) {
var c int

s := as
f := 0
_Mpmovecfix(a, 0)

c, s = intstarstringplusplus(s)
switch c {
case '-':
f = 1
fallthrough

case '+':
c, s = intstarstringplusplus(s)
if c != '0' {
break
}
fallthrough

case '0':
var c int
c, s = intstarstringplusplus(s)
if c == 'x' || c == 'X' {
s0 := s
var c int
c, _ = intstarstringplusplus(s)
for c != 0 {
if (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') {
s = s[1:]
c, _ = intstarstringplusplus(s)
continue
}

Yyerror("malformed hex constant: %s", as)
goto bad
}

mphextofix(a, s0)
if a.Ovf != 0 {
Yyerror("constant too large: %s", as)
goto bad
}
goto out
}
for c != 0 {
if c >= '0' && c <= '7' {
mpmulcfix(a, 8)
mpaddcfix(a, int64(c)-'0')
c, s = intstarstringplusplus(s)
continue
}

Yyerror("malformed octal constant: %s", as)
goto bad
}

goto out
}

for c != 0 {
if c >= '0' && c <= '9' {
mpmulcfix(a, 10)
mpaddcfix(a, int64(c)-'0')
c, s = intstarstringplusplus(s)
continue
}

Yyerror("malformed decimal constant: %s", as)
goto bad
}

goto out

out:
if f != 0 {
_mpnegfix(a)
}
return

bad:
_Mpmovecfix(a, 0)
}

func Bconv(xval *Mpint, flag int) string {
if flag&obj.FmtSharp != 0 {
return fmt.Sprintf("%#x", &xval.Val)
Expand Down

0 comments on commit 69b2f70

Please sign in to comment.