diff options
author | William Carroll <wpcarro@gmail.com> | 2022-09-06T05·18-0700 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-09-15T21·53+0000 |
commit | f859751c6a612205740698d67e083efe5cc4ee5e (patch) | |
tree | 916455711af15e1036aec44e592e78f0e991fb80 /tvix/eval/src/builtins/mod.rs | |
parent | 031ca653a34bd0ca7c3c3714239459d4069e6464 (diff) |
feat(tvix/eval): Support builtins.bitXor r/4869
Bitwise "exclusive-or" on integers. Change-Id: I90a0a15afb3a58662d70e82ea14e48b877476e04 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6550 Autosubmit: wpcarro <wpcarro@gmail.com> Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/builtins/mod.rs')
-rw-r--r-- | tvix/eval/src/builtins/mod.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tvix/eval/src/builtins/mod.rs b/tvix/eval/src/builtins/mod.rs index ebbc5e336c21..6098bba1e48f 100644 --- a/tvix/eval/src/builtins/mod.rs +++ b/tvix/eval/src/builtins/mod.rs @@ -115,6 +115,13 @@ fn pure_builtins() -> Vec<Builtin> { }) }) }), + Builtin::new("bitXor", 2, |args, vm| { + force!(vm, &args[0], x, { + force!(vm, &args[1], y, { + Ok(Value::Integer(x.as_int()? ^ y.as_int()?)) + }) + }) + }), Builtin::new("catAttrs", 2, |mut args, _| { let list = args.pop().unwrap().to_list()?; let key = args.pop().unwrap().to_str()?; |