mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 12:04:03 +00:00
compiler: rename biggestInt → capacityType
This commit is contained in:
committed by
Ron Evans
parent
b837c94366
commit
c7fdb6741f
+11
-11
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user