summaryrefslogtreecommitdiff
path: root/example/test_files/cycle
diff options
context:
space:
mode:
authorMatthew Sotoudeh <matthew@masot.net>2023-07-14 07:25:31 -0700
committerMatthew Sotoudeh <matthew@masot.net>2023-07-14 07:25:31 -0700
commit0b12ba0ca00f7cdfb50b614fb24b673fb7e4e322 (patch)
treec8dc0b54c6f9df2f10185fc93f4276f1a8535802 /example/test_files/cycle
initial code
Diffstat (limited to 'example/test_files/cycle')
-rw-r--r--example/test_files/cycle17
1 files changed, 17 insertions, 0 deletions
diff --git a/example/test_files/cycle b/example/test_files/cycle
new file mode 100644
index 0000000..e5fc1d3
--- /dev/null
+++ b/example/test_files/cycle
@@ -0,0 +1,17 @@
+mov tortoise $0
+mov hare $0
+mov cycle_found $0
+label loop
+ ; tortise = tortoise->next
+ load tortoise tortoise
+ ; hare = hare->next->next
+ load hare hare
+ load hare hare
+ ; are_eq = (tortoise == hare)
+ mov are_eq tortoise
+ eq are_eq hare
+ ; cycle found?
+ ite are_eq cycle loop
+label cycle
+ mov cycle_found $1
+end
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback