-
Notifications
You must be signed in to change notification settings - Fork 281
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
This code:
int result = 0;
if (result > 0x7fff)
result -= 0x10000L;got transpiled into this rust code on x64 linux:
let mut result: libc::c_int = 0i32;
if result > 0x7fffi32 {
result = (result as libc::c_long - 0x10000i64) as libc::c_int
}While this is technical correct. The generated code is less portable than the c version.
In fact, on x64 windows, this code will fail to compile with error:
|
1201 | result = (result as libc::c_long - 0x10000i64) as libc::c_int
| ^ no implementation for `i32 - i64`
|
= help: the trait `std::ops::Sub<i64>` is not implemented for `i32`
I think this can actually be improved somehow. specifically 0x10000L should be of type c_long instead of i64.
XVilka and samuela
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request