mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/internal/obj: replace Addr.U struct {...} with Val interface{}
An interface{} is more in the spirit of the original union.
By my calculations, on 64-bit systems this reduces
Addr from 120 to 80 bytes, and Prog from 592 to 424 bytes.
Change-Id: I0d7b0981513c2a3c94c9ac76bb4f8816485b5a3c
Reviewed-on: https://go-review.googlesource.com/7744
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
parent
631d6a33bf
commit
532ccae154
33 changed files with 164 additions and 164 deletions
|
|
@ -75,16 +75,16 @@ func savedata(ctxt *Link, s *LSym, p *Prog, pn string) {
|
|||
ctxt.Diag("unexpected %d-byte floating point constant", siz)
|
||||
|
||||
case 4:
|
||||
flt := math.Float32bits(float32(p.To.U.Dval))
|
||||
flt := math.Float32bits(float32(p.To.Val.(float64)))
|
||||
ctxt.Arch.ByteOrder.PutUint32(s.P[off:], flt)
|
||||
|
||||
case 8:
|
||||
flt := math.Float64bits(p.To.U.Dval)
|
||||
flt := math.Float64bits(p.To.Val.(float64))
|
||||
ctxt.Arch.ByteOrder.PutUint64(s.P[off:], flt)
|
||||
}
|
||||
|
||||
case TYPE_SCONST:
|
||||
copy(s.P[off:off+siz], p.To.U.Sval)
|
||||
copy(s.P[off:off+siz], p.To.Val.(string))
|
||||
|
||||
case TYPE_CONST, TYPE_ADDR:
|
||||
if p.To.Sym != nil || int(p.To.Type) == TYPE_ADDR {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue