feat: add as type casting

This commit is contained in:
2026-04-22 22:40:19 +02:00
parent e66a4ee736
commit 041a49e574
13 changed files with 350 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
[code]
fn cast_i32_to_f32(x: i32) -> f32 {
return x as f32;
}
fn cast_u64_to_f64(x: u64) -> f64 {
return x as f64;
}
[harness]
#include <stdint.h>
extern float cast_i32_to_f32(int32_t x);
extern double cast_u64_to_f64(uint64_t x);
int main() {
if (cast_i32_to_f32(42) != 42.0f) return 1;
if (cast_i32_to_f32(-10) != -10.0f) return 2;
if (cast_u64_to_f64(1337) != 1337.0) return 3;
return 0;
}
[expected_return_code]
0