Skip to content

Fix codegen for casting i32 <-> u32 and i32 -> u64  #250

@greenhat

Description

@greenhat

As described in #232 (comment)

I've looked into this issue, and the fix is to remove the call to assert_unsigned_int32 from cast when casting from i32 to u32, from u32 to i32, and from i32 to u64; and replace it with a call to a new helper called assert_i32, see the implementation of assert_i64 in emit/int64.rs for how to implement it.

The problem is that the assert_unsigned_int32 helper is intended to assert that the sign bit of a 32-bit value is unset, not to assert that the value is non-negative, which is how we are using it in cast.

All the other uses of assert_unsigned_int32 are correct

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions