reg: rename Bytes() to Size() (#74)

It was pointed out #73 that Bytes() is a poor name for the size of the register in bytes. In idiomatic Go you would probably expect a Bytes() method to return []byte.

This diff changes the Bytes() to Size(). As a result the Size type also needed to be renamed, and Width seemed a reasonable choice.

Fixes #73
This commit is contained in:
Michael McLoughlin
2019-04-01 20:27:44 -07:00
committed by GitHub
parent 7a0eb66183
commit 138eaf8dc3
5 changed files with 37 additions and 37 deletions

View File

@@ -39,7 +39,7 @@ func (c *Context) Load(src gotypes.Component, dst reg.Register) reg.Register {
c.adderror(err)
return dst
}
c.mov(b.Addr, dst, int(gotypes.Sizes.Sizeof(b.Type)), int(dst.Bytes()), b.Type)
c.mov(b.Addr, dst, int(gotypes.Sizes.Sizeof(b.Type)), int(dst.Size()), b.Type)
return dst
}
@@ -51,7 +51,7 @@ func (c *Context) Store(src reg.Register, dst gotypes.Component) {
c.adderror(err)
return
}
c.mov(src, b.Addr, int(src.Bytes()), int(gotypes.Sizes.Sizeof(b.Type)), b.Type)
c.mov(src, b.Addr, int(src.Size()), int(gotypes.Sizes.Sizeof(b.Type)), b.Type)
}
// Dereference loads a pointer and returns its element type.