I had encountered a bug when "manually" concatenating bytes into an int:
fn as_int(r: i32,g: i32,b: i32)-> i32 {((r&0xFF)<<24)|((r&0xFF)<<16)|(r&0xFF)|0xFF}transpiled into:
static int32_t cel_celes_as_int(int32_t r, int32_t g, int32_t b)
{
return (r & 0xFF) | 0xFF;
}
I had to shift in each byte as its own expression for it to work:
fn as_int(r: i32,g: i32,b: i32)-> i32 {letmutres: i32 =255;res=res|((r&0x0FF)<<24);res=res|((g&0x0FF)<<16);res=res|((b&0x0FF)<<8);returnres;}Haven't looked further into it though, not sure what caused it.
I had encountered a bug when "manually" concatenating bytes into an int:
```rust
fn as_int(r: i32, g: i32, b: i32) -> i32 {
((r & 0xFF) << 24) | ((r & 0xFF) << 16) | (r & 0xFF) | 0xFF
}
```
transpiled into:
```c
static int32_t cel_celes_as_int(int32_t r, int32_t g, int32_t b)
{
return (r & 0xFF) | 0xFF;
}
```
I had to shift in each byte as its own expression for it to work:
```rust
fn as_int(r: i32, g: i32, b: i32) -> i32 {
let mut res: i32 = 255;
res = res | ((r & 0x0FF) << 24);
res = res | ((g & 0x0FF) << 16);
res = res | ((b & 0x0FF) << 8);
return res;
}
```
Haven't looked further into it though, not sure what caused it.