Skip to main content

seq_runtime/
arithmetic.rs

1//! Arithmetic operations for Seq
2//!
3//! These FFI entry points are exported with C ABI for LLVM codegen to
4//! call. They are grouped into per-concern sub-modules and re-exported
5//! from here so the flat public surface is unchanged.
6//!
7//! # Overflow Behavior
8//!
9//! All arithmetic operations use wrapping semantics for defined behavior:
10//! - `add`: i64::MAX + 1 wraps to i64::MIN
11//! - `subtract`: i64::MIN - 1 wraps to i64::MAX
12//! - `multiply`: overflow wraps around
13//! - `divide`: i64::MIN / -1 wraps to i64::MIN (special case)
14
15mod arith;
16mod bitwise;
17mod compare;
18mod peek;
19
20#[cfg(test)]
21mod tests;
22
23pub use arith::*;
24pub use bitwise::*;
25pub use compare::*;
26pub use peek::*;
27
28// Short-name aliases used by tests and internal callers.
29pub use patch_seq_add as add;
30pub use patch_seq_and as and;
31pub use patch_seq_band as band;
32pub use patch_seq_bnot as bnot;
33pub use patch_seq_bor as bor;
34pub use patch_seq_bxor as bxor;
35pub use patch_seq_clz as clz;
36pub use patch_seq_ctz as ctz;
37pub use patch_seq_divide as divide;
38pub use patch_seq_eq as eq;
39pub use patch_seq_gt as gt;
40pub use patch_seq_gte as gte;
41pub use patch_seq_int_bits as int_bits;
42pub use patch_seq_lt as lt;
43pub use patch_seq_lte as lte;
44pub use patch_seq_modulo as modulo;
45pub use patch_seq_multiply as multiply;
46pub use patch_seq_neq as neq;
47pub use patch_seq_not as not;
48pub use patch_seq_or as or;
49pub use patch_seq_peek_bool_value as peek_bool_value;
50pub use patch_seq_peek_int_value as peek_int_value;
51pub use patch_seq_pop_stack as pop_stack;
52pub use patch_seq_popcount as popcount;
53pub use patch_seq_push_bool as push_bool;
54pub use patch_seq_push_int as push_int;
55pub use patch_seq_shl as shl;
56pub use patch_seq_shr as shr;
57pub use patch_seq_subtract as subtract;