Skip to content

Instantly share code, notes, and snippets.

@kittylyst
Created May 17, 2020 17:00
Show Gist options
  • Save kittylyst/034910dd55fd392dcd68274c246558f3 to your computer and use it in GitHub Desktop.
Save kittylyst/034910dd55fd392dcd68274c246558f3 to your computer and use it in GitHub Desktop.
fn double_mapper_factory(tfm: fn(f64) -> f64) -> fn(&InterpLocalVars) -> Option<JvmValue> {
|args: &InterpLocalVars| -> Option<JvmValue> {
let d = match args.load(0) {
JvmValue::Double { val: v } => v,
x => panic!("Non-double value {} of type {} encountered in Math", x, x.name())
};
Some(JvmValue::Double {val: tfm(d)})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment