Skip to content

Commit

Permalink
fix: const conversions for 32 bits (#3186)
Browse files Browse the repository at this point in the history
The const conversion pr broke 32bit platform build because the
comparison wasn't portable for that platform. This is a fix.
  • Loading branch information
petar-dambovaliev authored Nov 24, 2024
1 parent d0493df commit c6f8dd4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions gnovm/pkg/gnolang/values_conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ GNO_CASE:
tv.T = t
tv.SetUint16(x)
case Uint32Kind:
validate(IntKind, Uint32Kind, func() bool { return tv.GetInt() >= 0 && tv.GetInt() <= math.MaxUint32 })
validate(IntKind, Uint32Kind, func() bool { return tv.GetInt() >= 0 && uint64(tv.GetInt()) <= math.MaxUint32 })

x := uint32(tv.GetInt())
tv.T = t
Expand Down Expand Up @@ -501,7 +501,7 @@ GNO_CASE:
tv.T = t
tv.SetInt32(x)
case Int64Kind:
validate(UintKind, Int64Kind, func() bool { return tv.GetUint() <= math.MaxInt64 })
validate(UintKind, Int64Kind, func() bool { return uint64(tv.GetUint()) <= math.MaxInt64 })

x := int64(tv.GetUint())
tv.T = t
Expand Down Expand Up @@ -576,7 +576,7 @@ GNO_CASE:
tv.T = t
tv.SetInt32(x)
case Int64Kind:
validate(Uint8Kind, Int64Kind, func() bool { return int(tv.GetUint8()) <= math.MaxInt64 })
validate(Uint8Kind, Int64Kind, func() bool { return true })

x := int64(tv.GetUint8())
tv.T = t
Expand Down Expand Up @@ -645,7 +645,7 @@ GNO_CASE:
tv.T = t
tv.SetInt32(x)
case Int64Kind:
validate(Uint16Kind, Int64Kind, func() bool { return int(tv.GetUint16()) <= math.MaxInt64 })
validate(Uint16Kind, Int64Kind, func() bool { return true })

x := int64(tv.GetUint16())
tv.T = t
Expand Down Expand Up @@ -791,7 +791,7 @@ GNO_CASE:
tv.T = t
tv.SetInt32(x)
case Int64Kind:
validate(Uint64Kind, Int64Kind, func() bool { return int(tv.GetUint64()) <= math.MaxInt64 })
validate(Uint64Kind, Int64Kind, func() bool { return tv.GetUint64() <= math.MaxInt64 })

x := int64(tv.GetUint64())
tv.T = t
Expand All @@ -815,7 +815,7 @@ GNO_CASE:
tv.T = t
tv.SetUint16(x)
case Uint32Kind:
validate(Uint64Kind, Uint32Kind, func() bool { return int(tv.GetUint64()) <= math.MaxUint32 })
validate(Uint64Kind, Uint32Kind, func() bool { return tv.GetUint64() <= math.MaxUint32 })

x := uint32(tv.GetUint64())
tv.T = t
Expand Down

0 comments on commit c6f8dd4

Please sign in to comment.