aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/number-commands.c
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-11-15 08:57:03 +0100
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-11-15 08:57:03 +0100
commit902940401d1c1e657cdaf3e7bae8cbb89d14ffa9 (patch)
treee6811396df64a7d4e05788752d5a343357aa846f /src/number-commands.c
parentb0f4c1d2b5076c453f3767426db3eecbdc6dfd42 (diff)
added left shift (^<) and right shift (^>) operators
Previously you'd have to write `a * 2^*b` for left shift, which is inefficient and cumbersome.
Diffstat (limited to 'src/number-commands.c')
-rw-r--r--src/number-commands.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/number-commands.c b/src/number-commands.c
index 6ba2874..0656cf0 100644
--- a/src/number-commands.c
+++ b/src/number-commands.c
@@ -361,6 +361,18 @@ teco_state_start_comma(teco_machine_main_t *ctx, GError **error)
teco_expressions_push_op(TECO_OP_NEW);
}
+void
+teco_state_control_left_shift(teco_machine_main_t *ctx, GError **error)
+{
+ teco_expressions_push_calc(TECO_OP_SHL, error);
+}
+
+void
+teco_state_control_right_shift(teco_machine_main_t *ctx, GError **error)
+{
+ teco_expressions_push_calc(TECO_OP_SHR, error);
+}
+
/*$ ^_ negate
* n^_ -> ~n -- Binary negation
*