diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-09-19 21:44:48 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-09-19 21:44:48 -0700 |
commit | 8e4b4f2013b3f347e84398c70eabab60f6edd625 (patch) | |
tree | bf0e5f947ea43dbca51998bd4a27a05ffd8d161b /403unicode.mu | |
parent | 72e8240a23da7b82893d6b4e7ed3337ca0827049 (diff) | |
download | mu-8e4b4f2013b3f347e84398c70eabab60f6edd625.tar.gz |
6807 - tile: render intermediate stack state
Diffstat (limited to '403unicode.mu')
-rw-r--r-- | 403unicode.mu | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/403unicode.mu b/403unicode.mu index 23f14d8f..dcb1e658 100644 --- a/403unicode.mu +++ b/403unicode.mu @@ -373,3 +373,24 @@ fn test-shift-left-bytes-5 { #? run-tests #? r <- copy 0 #? } + +# write a grapheme to a stream of bytes +# this is like write-to-stream, except we skip leading 0 bytes +fn write-grapheme out: (addr stream byte), g: grapheme { +$write-grapheme:body: { + var c/eax: int <- copy g + append-byte out, c # first byte is always written + c <- shift-right 8 + compare c, 0 + break-if-= $write-grapheme:body + append-byte out, c + c <- shift-right 8 + compare c, 0 + break-if-= $write-grapheme:body + append-byte out, c + c <- shift-right 8 + compare c, 0 + break-if-= $write-grapheme:body + append-byte out, c +} +} |