Make mod() a macro that can take generic types instead of just integer

This commit is contained in:
Olivier Goffart 2022-07-11 16:54:17 +02:00 committed by Olivier Goffart
parent d48c590346
commit 92b4f52556
9 changed files with 78 additions and 15 deletions

View file

@ -2363,11 +2363,7 @@ fn compile_builtin_function_call(
BuiltinFunction::Debug => {
format!("std::cout << {} << std::endl;", a.join("<<"))
}
BuiltinFunction::Mod => format!(
"static_cast<int>({}) % static_cast<int>({})",
a.next().unwrap(),
a.next().unwrap()
),
BuiltinFunction::Mod => format!("std::fmod({}, {})", a.next().unwrap(), a.next().unwrap()),
BuiltinFunction::Round => format!("std::round({})", a.next().unwrap()),
BuiltinFunction::Ceil => format!("std::ceil({})", a.next().unwrap()),
BuiltinFunction::Floor => format!("std::floor({})", a.next().unwrap()),