vile / scheme / fast_call.v
20 lines · 19 sloc · 753 bytes · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1module scheme
2
3// An unspecified handle asks the caller to use the complete numeric protocol.
4// This leaf never allocates or creates an error: overflow and division retain
5// their normal promotion/recovery path. Only guarded integer operands reach it.
6@[inline]
7fn small_integer_call(p Primitive, a i64, b i64) Value {
8 match p {
9 .add { if n := small_add(a, b) { return integer(n) } }
10 .subtract { if n := small_subtract(a, b) { return integer(n) } }
11 .multiply { if n := small_multiply(a, b) { return integer(n) } }
12 .num_eq { return boolean(a == b) }
13 .less { return boolean(a < b) }
14 .greater { return boolean(a > b) }
15 .less_equal { return boolean(a <= b) }
16 .greater_equal { return boolean(a >= b) }
17 else {}
18 }
19 return unspecified()
20}
21