compiler: rename biggestInt → capacityType

Этот коммит содержится в:
Ayke van Laethem 2019-02-07 17:54:34 +01:00 коммит произвёл Ron Evans
родитель b837c94366
коммит c7fdb6741f

Просмотреть файл

@ -1748,27 +1748,27 @@ func (c *Compiler) parseExpr(frame *Frame, expr ssa.Value) (llvm.Value, error) {
// Bounds checking. // Bounds checking.
if !frame.fn.IsNoBounds() { if !frame.fn.IsNoBounds() {
checkFunc := "sliceBoundsCheckMake" checkFunc := "sliceBoundsCheckMake"
biggestInt := c.uintptrType capacityType := c.uintptrType
biggestIntWidth := biggestInt.IntTypeWidth() capacityTypeWidth := capacityType.IntTypeWidth()
if sliceLen.Type().IntTypeWidth() > biggestIntWidth || sliceCap.Type().IntTypeWidth() > biggestIntWidth { if sliceLen.Type().IntTypeWidth() > capacityTypeWidth || sliceCap.Type().IntTypeWidth() > capacityTypeWidth {
// System that is less than 64bit, meaning that the slice make // System that is less than 64bit, meaning that the slice make
// params are bigger than uintptr. // params are bigger than uintptr.
checkFunc = "sliceBoundsCheckMake64" checkFunc = "sliceBoundsCheckMake64"
biggestInt = c.ctx.Int64Type() capacityType = c.ctx.Int64Type()
biggestIntWidth = biggestInt.IntTypeWidth() capacityTypeWidth = capacityType.IntTypeWidth()
} }
if sliceLen.Type().IntTypeWidth() < biggestIntWidth { if sliceLen.Type().IntTypeWidth() < capacityTypeWidth {
if expr.Len.Type().(*types.Basic).Info()&types.IsUnsigned != 0 { if expr.Len.Type().(*types.Basic).Info()&types.IsUnsigned != 0 {
sliceLen = c.builder.CreateZExt(sliceLen, biggestInt, "") sliceLen = c.builder.CreateZExt(sliceLen, capacityType, "")
} else { } else {
sliceLen = c.builder.CreateSExt(sliceLen, biggestInt, "") sliceLen = c.builder.CreateSExt(sliceLen, capacityType, "")
} }
} }
if sliceCap.Type().IntTypeWidth() < biggestIntWidth { if sliceCap.Type().IntTypeWidth() < capacityTypeWidth {
if expr.Cap.Type().(*types.Basic).Info()&types.IsUnsigned != 0 { if expr.Cap.Type().(*types.Basic).Info()&types.IsUnsigned != 0 {
sliceCap = c.builder.CreateZExt(sliceCap, biggestInt, "") sliceCap = c.builder.CreateZExt(sliceCap, capacityType, "")
} else { } else {
sliceCap = c.builder.CreateSExt(sliceCap, biggestInt, "") sliceCap = c.builder.CreateSExt(sliceCap, capacityType, "")
} }
} }
maxSliceSize := maxSize maxSliceSize := maxSize