savi-lang / savi

A fast language for programmers who are passionate about their craft.
BSD 3-Clause "New" or "Revised" License
155 stars 12 forks source link

Fix missing truncate implementation in signed numeric conversion. #361

Closed jemc closed 1 year ago

jemc commented 1 year ago

Prior to this commit, this code was assumed that underflow testing on partial numeric conversion would only be used when the source type is a signed integer and the dest type has a smaller width. But this can also happen when the dest type has a greater or equal width when the dest type is unsigned, because all negative numbers are treated as underflow in that case.

This commit fixes the issue by implementing that case.