diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-15 19:49:52 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-15 19:49:52 -0700 |
commit | 74151efc043c984ae328be599417570a8b75ff0f (patch) | |
tree | cef52e95620cfc4311f6b125b3558f25eeb42156 /506math.mu | |
parent | c4475d83b747475663ad089b63169df88842be51 (diff) | |
download | mu-74151efc043c984ae328be599417570a8b75ff0f.tar.gz |
reimplement Bresenham line in Mu
Diffstat (limited to '506math.mu')
-rw-r--r-- | 506math.mu | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/506math.mu b/506math.mu new file mode 100644 index 00000000..d4e4194c --- /dev/null +++ b/506math.mu @@ -0,0 +1,21 @@ +fn abs n: int -> _/eax: int { + compare n, 0 + { + break-if->= + negate n + } + return n +} + +fn sgn n: int -> _/eax: int { + compare n, 0 + { + break-if-<= + return 1 + } + { + break-if->= + return -1 + } + return 0 +} |