#include <metal_stdlib> | |
using namespace metal; | |
struct S { | |
int a; | |
}; | |
struct tint_module_vars_struct { | |
device S* v; | |
}; | |
int tint_div_i32(int lhs, int rhs) { | |
uint const v_1 = uint((lhs == (-2147483647 - 1))); | |
bool const v_2 = bool((v_1 & uint((rhs == -1)))); | |
uint const v_3 = uint((rhs == 0)); | |
return (lhs / select(rhs, 1, bool((v_3 | uint(v_2))))); | |
} | |
void foo(tint_module_vars_struct tint_module_vars) { | |
(*tint_module_vars.v).a = tint_div_i32((*tint_module_vars.v).a, 2); | |
} |