mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
compiler: fix int casting to use the source signedness
Previously, when casting an integer to a bigger integer, the destination signedness was used. This is problematic when casting a negative int16 to uint32, for example, because it would cause zero-extension.
This commit is contained in:
committed by
Ron Evans
parent
81a1114ee5
commit
3a76a49ddf
@@ -39,7 +39,7 @@ func printuint16(n uint16) {
|
||||
printuint32(uint32(n))
|
||||
}
|
||||
|
||||
func printint16(n uint16) {
|
||||
func printint16(n int16) {
|
||||
printint32(int32(n))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user