all: remove redundant type conversion
Change-Id: I1bff578bdcacac6ea471ed9effb9d9ade573d813
GitHub-Last-Rev: 43904f8dd8f08028af8870fb8de4c1662594887e
GitHub-Pull-Request: golang/arch#6
Reviewed-on: https://go-review.googlesource.com/c/arch/+/428983
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
diff --git a/arm/armasm/decode.go b/arm/armasm/decode.go
index 6b4d738..f61ac12 100644
--- a/arm/armasm/decode.go
+++ b/arm/armasm/decode.go
@@ -17,7 +17,9 @@
// If x matches the format, then the rest of the fields describe how to interpret x.
// The opBits describe bits that should be extracted from x and added to the opcode.
// For example opBits = 0x1234 means that the value
+//
// (2 bits at offset 1) followed by (4 bits at offset 3)
+//
// should be added to op.
// Finally the args describe how to decode the instruction arguments.
// args is stored as a fixed-size array; if there are fewer than len(args) arguments,
@@ -233,9 +235,9 @@
typ, count := decodeShift(x)
// ROR #0 here means ROR #0, but decodeShift rewrites to RRX #1.
if typ == RotateRightExt {
- return Reg(Rm)
+ return Rm
}
- return RegShift{Rm, typ, uint8(count)}
+ return RegShift{Rm, typ, count}
case arg_R_shift_R:
Rm := Reg(x & (1<<4 - 1))
@@ -249,7 +251,7 @@
if typ == ShiftLeft && count == 0 {
return Reg(Rm)
}
- return RegShift{Rm, typ, uint8(count)}
+ return RegShift{Rm, typ, count}
case arg_R1_0:
return Reg((x & (1<<4 - 1)))
diff --git a/ppc64/ppc64asm/field.go b/ppc64/ppc64asm/field.go
index 882c91a..13df063 100644
--- a/ppc64/ppc64asm/field.go
+++ b/ppc64/ppc64asm/field.go
@@ -67,7 +67,7 @@
// the sequence of bitfields is reasonable.
func (bs BitFields) parse(i [2]uint32) (u uint64, Bits uint8) {
for _, b := range bs {
- u = (uint64(u) << b.Bits) | uint64(b.Parse(i))
+ u = (u << b.Bits) | uint64(b.Parse(i))
Bits += b.Bits
}
return u, Bits