diff options
Diffstat (limited to 'apps/tile/value-stack.mu')
-rw-r--r-- | apps/tile/value-stack.mu | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/tile/value-stack.mu b/apps/tile/value-stack.mu index b7b794c6..8e921eca 100644 --- a/apps/tile/value-stack.mu +++ b/apps/tile/value-stack.mu @@ -86,3 +86,29 @@ fn value-stack-length _self: (addr value-stack) -> result/eax: int { var top-addr/eax: (addr int) <- get self, top result <- copy *top-addr } + +fn value-stack-max-width _self: (addr value-stack) -> result/eax: int { + var self/esi: (addr value-stack) <- copy _self + var data-ah/edi: (addr handle array value) <- get self, data + var _data/eax: (addr array value) <- lookup *data-ah + var data/edi: (addr array value) <- copy _data + var top-addr/ecx: (addr int) <- get self, top + var i/ebx: int <- copy 0 + var out: int + { + compare i, *top-addr + break-if->= + var o/edx: (offset value) <- compute-offset data, i + var g/edx: (addr value) <- index data, o + var g2/edx: (addr int) <- get g, scalar-data + var w/eax: int <- decimal-size *g2 + compare w, out + { + break-if-<= + copy-to out, w + } + i <- increment + loop + } + result <- copy out +} |