about summary refs log tree commit diff stats
path: root/Makefile
stat options
Period:
Authors:

Commits per author per week (path 'Makefile')

AuthorW43 2024W44 2024W45 2024W46 2024Total
Total00000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Unnecessarily use an array to sum 1..10
#
# To run:
#   $ ./translate apps/ex3.2.mu
#   $ ./a.elf
#   $ echo $?
#   55

fn main -> _/ebx: int {
  # populate a
  var a: (array int 0xb)  # 11; we waste index 0
  var i/ecx: int <- copy 1
  {
    compare i, 0xb
    break-if->=
    var x/eax: (addr int) <- index a, i
    copy-to *x, i
    i <- increment
    loop
  }
  # sum
  var result/edx: int <- copy 0
  i <- copy 1
  {
    compare i, 0xb
    break-if->=
    var x/eax: (addr int) <- index a, i
    result <- add *x
    i <- increment
    loop
  }
  return result
}