diff options
Diffstat (limited to 'pkg/k8s.io/apimachinery')
-rw-r--r-- | pkg/k8s.io/apimachinery/pkg/api/resource/amount.go | 2 | ||||
-rw-r--r-- | pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go b/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go index 9f76f9154..d05984dac 100644 --- a/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go +++ b/pkg/k8s.io/apimachinery/pkg/api/resource/amount.go @@ -221,7 +221,7 @@ func (a int64Amount) AsCanonicalBytes(out []byte) (result []byte, exponent int32 exponent = int32(a.scale) amount, times := removeInt64Factors(mantissa, 10) - exponent += int32(times) + exponent += times // make sure exponent is a multiple of 3 var ok bool diff --git a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go index 965d2ccaf..dcc5df219 100644 --- a/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go +++ b/pkg/k8s.io/apimachinery/pkg/api/resource/quantity.go @@ -293,7 +293,7 @@ func ParseQuantity(str string) (Quantity, error) { switch { case exponent >= 0 && len(denom) == 0: // only handle positive binary numbers with the fast path - mantissa = int64(int64(mantissa) << uint64(exponent)) + mantissa <<= uint64(exponent) // 1Mi (2^20) has ~6 digits of decimal precision, so exponent*3/10 -1 is roughly the precision precision = 15 - int32(len(num)) - int32(float32(exponent)*3/10) - 1 default: @@ -313,7 +313,7 @@ func ParseQuantity(str string) (Quantity, error) { if err != nil { return Quantity{}, ErrNumeric } - if result, ok := int64Multiply(value, int64(mantissa)); ok { + if result, ok := int64Multiply(value, mantissa); ok { if !positive { result = -result } |