summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cstr.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-09-25 14:51:35 +0200
committerTyge Løvset <[email protected]>2022-09-25 15:09:23 +0200
commit2093b18689383286915df511167a12dc5d7bc75f (patch)
tree174779ae7e7b4f6d10ec8be300ea9574e2395729 /include/stc/cstr.h
parent756120e349a892ef1b7655fc777f28ec13845300 (diff)
downloadSTC-modified-2093b18689383286915df511167a12dc5d7bc75f.tar.gz
STC-modified-2093b18689383286915df511167a12dc5d7bc75f.zip
Added: crange number generator type. (similar to c++ std::iota). Fixed c_forfilter again. Cleanups. Docs added.
Diffstat (limited to 'include/stc/cstr.h')
-rw-r--r--include/stc/cstr.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/stc/cstr.h b/include/stc/cstr.h
index 961ca344..7b382085 100644
--- a/include/stc/cstr.h
+++ b/include/stc/cstr.h
@@ -48,7 +48,7 @@
enum { cstr_s_cap = sizeof(cstr_buf) - 1 };
#define cstr_s_size(s) ((size_t)(cstr_s_cap - (s)->sml.last))
-#define cstr_s_set_size(s, len) ((s)->sml.last = cstr_s_cap - (len), (s)->sml.data[len] = 0)
+#define cstr_s_set_size(s, len) ((s)->sml.last = (uint8_t)(cstr_s_cap - (len)), (s)->sml.data[len] = 0)
#define cstr_s_data(s) (s)->sml.data
#define cstr_s_end(s) ((s)->sml.data + cstr_s_size(s))
@@ -237,7 +237,7 @@ STC_INLINE void cstr_next(cstr_iter* it) {
it->u8.chr.size = utf8_chr_size(it->ref);
if (!*it->ref) it->ref = NULL;
}
-STC_INLINE cstr_iter cstr_advance(cstr_iter it, isize_t pos) {
+STC_INLINE cstr_iter cstr_advance(cstr_iter it, intptr_t pos) {
int inc = -1;
if (pos > 0) pos = -pos, inc = 1;
while (pos && *it.ref) pos += (*(it.ref += inc) & 0xC0) != 0x80;