1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-25 06:29:17 +00:00
millfork/include/scrstring_fastindices.mfk

54 lines
948 B
Plaintext
Raw Normal View History

2019-10-31 16:29:05 +00:00
#if NULLCHAR_SAME
#error The module scrstring_fastindices should not be included directly
#endif
byte scrstrzlen(pointer str) {
byte index
index = 0
while str[index] != nullchar_scr {
index += 1
}
return index
}
sbyte scrstrzcmp(pointer str1, pointer str2) {
byte i1
byte i2
i1 = 0
i2 = 0
while true {
if str1[i1] != str2[i2] {
if str1[i1] < str2[i2] { return -1 }
return 1
}
if str1[i1] == nullchar_scr {
return 0
}
i1 += 1
i2 += 1
}
}
void scrstrzcopy(pointer dest, pointer src) {
byte i
byte c
i = 0
do {
c = src[i]
dest[i] = c
i += 1
} while c != nullchar_scr
}
2019-11-04 01:29:16 +00:00
2020-04-06 09:54:11 +00:00
void scrstrzpaste(pointer dest, pointer src) {
2019-11-04 01:29:16 +00:00
byte i
byte c
i = 0
while true {
c = src[i]
if c == nullchar_scr { return }
dest[i] = c
i += 1
}
}