1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-26 05:08:06 +11:00
collapseos/apps/lib
Clanmaster21 9cddaf1b59 String functions optimised (#86)
* String functions optimised

A few functions have been tweaked, but the biggest changes are in strlen, strskip and toWS, which take around two third of the cycles they used to (although strskip has more overhead). 10 bytes saved total.
toWS had two bytes added inlining the isWS call, and a jump to unsetZ was inlined too, saving a byte. This saved 29 cycles, with the original function being 90 cycles. I looked at other uses of isWS and it's difficult to inline it effectively in every situation, so I haven't inlined it elsewhere.
rdWS had a byte and two cycles saved by inlining a jump to unsetZ.
strskip is the same size, with the loop cut down from 35 cycles to 21 cycles, but 18 cycles are added outside the loop. I expect one character strings are in the minority, so this should save cycles overall.
strlen had 8 bytes saved, with the loop cut down from 38 cycles to 21 cycles, and 18 cycles removed outside the loop.

* Fixed strskip

Strskip wasn't preserving a properly. The new code uses the shadow af register, so whilst a byte and 4 cycles have been added outside the loop, it's safer and cleaner. The flags register isn't affected, but since the search goes for up to 64Kb I think it's safe to say the end of the string will always be reached.

* Remove inlining of isWS
2020-01-09 20:10:27 -05:00
..
ari.asm lib/expr: refactor for easier operator addition 2019-11-22 14:45:12 -05:00
expr.asm lib/expr: make EXPR_PARSE "tail" HL 2019-12-30 19:24:53 -05:00
fmt.asm recipes/rc2014/zasm: use BASIC shell 2019-12-11 13:01:51 -05:00
parse.asm Reworked parseHexadecimal and parseDecimal, other minor tweaks (#85) 2020-01-08 16:12:40 -05:00
README.md apps/ed: add (dummy) line number processing 2019-07-13 11:53:30 -04:00
util.asm String functions optimised (#86) 2020-01-09 20:10:27 -05:00

Common code used by more than one app, but not by the kernel.