summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/stc/algo/csort.h4
-rw-r--r--include/stc/ccommon.h9
-rw-r--r--include/stc/cdeq.h2
-rw-r--r--include/stc/cmap.h48
-rw-r--r--include/stc/cpque.h2
-rw-r--r--include/stc/crandom.h2
-rw-r--r--include/stc/cregex.h14
-rw-r--r--include/stc/csmap.h16
-rw-r--r--include/stc/cstack.h2
-rw-r--r--include/stc/cstr.h2
-rw-r--r--include/stc/cvec.h2
-rw-r--r--include/stc/forward.h14
-rw-r--r--include/stc/priv/template.h2
-rw-r--r--include/stc/utf8.h4
14 files changed, 59 insertions, 64 deletions
diff --git a/include/stc/algo/csort.h b/include/stc/algo/csort.h
index 9c9bcd5b..c8c41257 100644
--- a/include/stc/algo/csort.h
+++ b/include/stc/algo/csort.h
@@ -99,7 +99,7 @@ static inline void c_PASTE(cqsort_, i_tag)(i_val arr[], intptr_t lo, intptr_t hi
}
}
-static inline void c_PASTE(csort_, i_tag)(i_val arr[], size_t n)
- { c_PASTE(cqsort_, i_tag)(arr, 0, (intptr_t)n - 1); }
+static inline void c_PASTE(csort_, i_tag)(i_val arr[], intptr_t n)
+ { c_PASTE(cqsort_, i_tag)(arr, 0, n - 1); }
#include <stc/priv/template.h>
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index f0d157e3..30184407 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -32,13 +32,10 @@
#include "priv/altnames.h"
#define c_NPOS INTPTR_MAX
-#if SIZE_MAX == UINT32_MAX
- #define c_ZU PRIu32
-#elif SIZE_MAX == UINT64_MAX
- #define c_ZU PRIu64
-#endif
+#define c_ZI PRIiPTR
+#define c_ZU PRIuPTR
#if defined STC_NDEBUG || defined NDEBUG
- #define c_ASSERT(expr) (void)(expr)
+ #define c_ASSERT(expr) (void)(0)
#else
#define c_ASSERT(expr) assert(expr)
#endif
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h
index 44c5e8d5..56c0e867 100644
--- a/include/stc/cdeq.h
+++ b/include/stc/cdeq.h
@@ -110,7 +110,7 @@ STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
STC_INLINE void _cx_memb(_next)(_cx_iter* it)
{ if (++it->ref == it->end) it->ref = NULL; }
-STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, intptr_t n)
+STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t n)
{ if ((it.ref += n) >= it.end) it.ref = NULL; return it; }
#if !defined _i_queue
diff --git a/include/stc/cmap.h b/include/stc/cmap.h
index f9cd6986..f90d9a4a 100644
--- a/include/stc/cmap.h
+++ b/include/stc/cmap.h
@@ -53,7 +53,7 @@ int main(void) {
#include "forward.h"
#include <stdlib.h>
#include <string.h>
-typedef struct { size_t idx; uint8_t hx; } chash_bucket_t;
+typedef struct { intptr_t idx; uint8_t hx; } chash_bucket_t;
#endif // CMAP_H_INCLUDED
#ifndef _i_prefix
@@ -96,13 +96,13 @@ typedef _i_SET_ONLY( i_keyraw )
i_valraw second; } )
_cx_raw;
-STC_API _cx_self _cx_memb(_with_capacity)(size_t cap);
+STC_API _cx_self _cx_memb(_with_capacity)(intptr_t cap);
#if !defined i_no_clone
STC_API _cx_self _cx_memb(_clone)(_cx_self map);
#endif
STC_API void _cx_memb(_drop)(_cx_self* self);
STC_API void _cx_memb(_clear)(_cx_self* self);
-STC_API bool _cx_memb(_reserve)(_cx_self* self, size_t capacity);
+STC_API bool _cx_memb(_reserve)(_cx_self* self, intptr_t capacity);
STC_API chash_bucket_t _cx_memb(_bucket_)(const _cx_self* self, const _cx_rawkey* rkeyptr);
STC_API _cx_result _cx_memb(_insert_entry_)(_cx_self* self, _cx_rawkey rkey);
STC_API void _cx_memb(_erase_entry)(_cx_self* self, _cx_value* val);
@@ -111,10 +111,10 @@ STC_INLINE _cx_self _cx_memb(_init)(void) { return c_LITERAL(_cx_self){0}; }
STC_INLINE void _cx_memb(_shrink_to_fit)(_cx_self* self) { _cx_memb(_reserve)(self, self->size); }
STC_INLINE float _cx_memb(_max_load_factor)(const _cx_self* self) { return (float)(i_max_load_factor); }
STC_INLINE bool _cx_memb(_empty)(const _cx_self* map) { return !map->size; }
-STC_INLINE size_t _cx_memb(_size)(const _cx_self* map) { return map->size; }
-STC_INLINE size_t _cx_memb(_bucket_count)(_cx_self* map) { return map->bucket_count; }
-STC_INLINE size_t _cx_memb(_capacity)(const _cx_self* map)
- { return (size_t)((float)map->bucket_count * (i_max_load_factor)); }
+STC_INLINE intptr_t _cx_memb(_size)(const _cx_self* map) { return map->size; }
+STC_INLINE intptr_t _cx_memb(_bucket_count)(_cx_self* map) { return map->bucket_count; }
+STC_INLINE intptr_t _cx_memb(_capacity)(const _cx_self* map)
+ { return (intptr_t)((float)map->bucket_count * (i_max_load_factor)); }
STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, _cx_rawkey rkey)
{ return self->size && self->_hashx[_cx_memb(_bucket_)(self, &rkey).idx]; }
@@ -195,7 +195,7 @@ _cx_memb(_push)(_cx_self* self, _cx_value _val) {
return _res;
}
-STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, size_t n) {
+STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, intptr_t n) {
while (n--)
#if defined _i_isset && defined i_no_emplace
_cx_memb(_insert)(self, *raw++);
@@ -208,7 +208,7 @@ STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, size_t n) {
#endif
}
-STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, size_t n)
+STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, intptr_t n)
{ _cx_self cx = {0}; _cx_memb(_put_n)(&cx, raw, n); return cx; }
STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
@@ -238,7 +238,7 @@ _cx_memb(_advance)(_cx_iter it, size_t n) {
STC_INLINE _cx_iter
_cx_memb(_find)(const _cx_self* self, _cx_rawkey rkey) {
- size_t idx;
+ intptr_t idx;
if (self->size && self->_hashx[idx = _cx_memb(_bucket_)(self, &rkey).idx])
return c_LITERAL(_cx_iter){self->table + idx,
self->table + self->bucket_count,
@@ -248,7 +248,7 @@ _cx_memb(_find)(const _cx_self* self, _cx_rawkey rkey) {
STC_INLINE const _cx_value*
_cx_memb(_get)(const _cx_self* self, _cx_rawkey rkey) {
- size_t idx;
+ intptr_t idx;
if (self->size && self->_hashx[idx = _cx_memb(_bucket_)(self, &rkey).idx])
return self->table + idx;
return NULL;
@@ -258,12 +258,12 @@ STC_INLINE _cx_value*
_cx_memb(_get_mut)(_cx_self* self, _cx_rawkey rkey)
{ return (_cx_value*)_cx_memb(_get)(self, rkey); }
-STC_INLINE size_t
+STC_INLINE intptr_t
_cx_memb(_erase)(_cx_self* self, _cx_rawkey rkey) {
if (self->size == 0)
return 0;
chash_bucket_t b = _cx_memb(_bucket_)(self, &rkey);
- return self->_hashx[b.idx] ? _cx_memb(_erase_entry)(self, self->table + b.idx), 1U : 0U;
+ return self->_hashx[b.idx] ? _cx_memb(_erase_entry)(self, self->table + b.idx), 1 : 0;
}
STC_INLINE _cx_iter
@@ -278,11 +278,11 @@ _cx_memb(_erase_at)(_cx_self* self, _cx_iter it) {
#if defined(i_implement)
#ifndef CMAP_H_INCLUDED
-STC_INLINE size_t fastrange_1(uint64_t x, uint64_t n)
- { return (size_t)((uint32_t)x*n >> 32); } // n < 2^32
+STC_INLINE intptr_t fastrange_1(uint64_t x, uint64_t n)
+ { return (intptr_t)((uint32_t)x*n >> 32); } // n < 2^32
-STC_INLINE size_t fastrange_2(uint64_t x, uint64_t n)
- { return x & (n - 1); } // n power of 2.
+STC_INLINE intptr_t fastrange_2(uint64_t x, uint64_t n)
+ { return (intptr_t)(x & (n - 1)); } // n power of 2.
STC_INLINE uint64_t next_power_of_2(uint64_t n) {
n--;
@@ -294,7 +294,7 @@ STC_INLINE uint64_t next_power_of_2(uint64_t n) {
#endif // CMAP_H_INCLUDED
STC_DEF _cx_self
-_cx_memb(_with_capacity)(const size_t cap) {
+_cx_memb(_with_capacity)(const intptr_t cap) {
_cx_self h = {0};
_cx_memb(_reserve)(&h, cap);
return h;
@@ -319,7 +319,7 @@ STC_DEF void _cx_memb(_drop)(_cx_self* self) {
STC_DEF void _cx_memb(_clear)(_cx_self* self) {
_cx_memb(_wipe_)(self);
self->size = 0;
- memset(self->_hashx, 0, self->bucket_count);
+ c_memset(self->_hashx, 0, self->bucket_count);
}
#ifndef _i_isset
@@ -355,7 +355,7 @@ STC_DEF chash_bucket_t
_cx_memb(_bucket_)(const _cx_self* self, const _cx_rawkey* rkeyptr) {
const uint64_t _hash = i_hash_functor(self, rkeyptr);
i_size _cap = self->bucket_count;
- chash_bucket_t b = {c_PASTE(fastrange_,_i_expandby)(_hash, _cap), (uint8_t)(_hash | 0x80)};
+ chash_bucket_t b = {c_PASTE(fastrange_,_i_expandby)(_hash, (uint64_t)_cap), (uint8_t)(_hash | 0x80)};
const uint8_t* _hx = self->_hashx;
while (_hx[b.idx]) {
if (_hx[b.idx] == b.hx) {
@@ -390,7 +390,7 @@ STC_DEF _cx_self
_cx_memb(_clone)(_cx_self m) {
if (m.table) {
_cx_value *t = c_ALLOC_N(_cx_value, m.bucket_count), *dst = t, *m_end = m.table + m.bucket_count;
- uint8_t *h = (uint8_t *)memcpy(c_malloc(m.bucket_count + 1), m._hashx, m.bucket_count + 1);
+ uint8_t *h = (uint8_t *)c_memcpy(c_malloc(m.bucket_count + 1), m._hashx, m.bucket_count + 1);
if (!(t && h))
{ c_free(t), c_free(h), t = 0, h = 0, m.bucket_count = 0; }
else
@@ -404,7 +404,7 @@ _cx_memb(_clone)(_cx_self m) {
#endif
STC_DEF bool
-_cx_memb(_reserve)(_cx_self* self, const size_t _newcap) {
+_cx_memb(_reserve)(_cx_self* self, const intptr_t _newcap) {
const i_size _oldbuckets = self->bucket_count;
if (_newcap != self->size && _newcap <= _oldbuckets)
return true;
@@ -424,7 +424,7 @@ _cx_memb(_reserve)(_cx_self* self, const size_t _newcap) {
m._hashx[_nbuckets] = 0xff;
const _cx_value* e = self->table;
const uint8_t* h = self->_hashx;
- for (size_t i = 0; i < _oldbuckets; ++i, ++e) if (*h++) {
+ for (i_size i = 0; i < _oldbuckets; ++i, ++e) if (*h++) {
_cx_rawkey r = i_keyto(_i_keyref(e));
chash_bucket_t b = _cx_memb(_bucket_)(&m, &r);
m.table[b.idx] = *e;
@@ -450,7 +450,7 @@ _cx_memb(_erase_entry)(_cx_self* self, _cx_value* _val) {
if (! _hashx[j])
break;
const _cx_rawkey _raw = i_keyto(_i_keyref(_slot + j));
- k = (i_size)c_PASTE(fastrange_,_i_expandby)(i_hash_functor(self, (&_raw)), _cap);
+ k = (i_size)c_PASTE(fastrange_,_i_expandby)(i_hash_functor(self, (&_raw)), (uint64_t)_cap);
if ((j < i) ^ (k <= i) ^ (k > j)) /* is k outside (i, j]? */
_slot[i] = _slot[j], _hashx[i] = _hashx[j], i = j;
}
diff --git a/include/stc/cpque.h b/include/stc/cpque.h
index 21130864..55df70ef 100644
--- a/include/stc/cpque.h
+++ b/include/stc/cpque.h
@@ -55,7 +55,7 @@ STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, intptr_t n)
STC_INLINE bool _cx_memb(_reserve)(_cx_self* self, const intptr_t cap) {
if (cap != self->_len && cap <= self->_cap) return true;
- _cx_value *d = (_cx_value *)c_realloc(self->data, cap*sizeof *d);
+ _cx_value *d = (_cx_value *)c_realloc(self->data, cap*c_sizeof *d);
return d ? (self->data = d, self->_cap = cap, true) : false;
}
diff --git a/include/stc/crandom.h b/include/stc/crandom.h
index 5641d788..32e541ff 100644
--- a/include/stc/crandom.h
+++ b/include/stc/crandom.h
@@ -46,7 +46,7 @@ int main() {
typedef struct stc64 { uint64_t state[5]; } stc64_t;
typedef struct stc64_uniform { int64_t lower; uint64_t range, threshold; } stc64_uniform_t;
typedef struct stc64_uniformf { double lower, range; } stc64_uniformf_t;
-typedef struct stc64_normalf { double mean, stddev, next; unsigned has_next; } stc64_normalf_t;
+typedef struct stc64_normalf { double mean, stddev, next; int has_next; } stc64_normalf_t;
/* PRNG stc64.
* Very fast PRNG suited for parallel usage with Weyl-sequence parameter.
diff --git a/include/stc/cregex.h b/include/stc/cregex.h
index c41fbb67..564fe157 100644
--- a/include/stc/cregex.h
+++ b/include/stc/cregex.h
@@ -105,7 +105,7 @@ STC_INLINE cregex cregex_from_2(const char* pattern, int cflags) {
}
/* number of capture groups in a regex pattern including full the match capture, 0 if regex is invalid */
-unsigned cregex_captures(const cregex* re);
+int cregex_captures(const cregex* re);
/* return CREG_OK, CREG_NOMATCH or CREG_MATCHERROR. */
#define cregex_find(...) c_MACRO_OVERLOAD(cregex_find, __VA_ARGS__)
@@ -132,17 +132,17 @@ STC_INLINE bool cregex_is_match(const cregex* re, const char* input)
/* replace csview input with replace using regular expression pattern */
#define cregex_replace_sv(...) c_MACRO_OVERLOAD(cregex_replace_sv, __VA_ARGS__)
#define cregex_replace_sv_3(pattern, input, replace) \
- cregex_replace_sv_4(pattern, input, replace, ~0U)
+ cregex_replace_sv_4(pattern, input, replace, INT32_MAX)
#define cregex_replace_sv_4(pattern, input, replace, count) \
cregex_replace_sv_6(pattern, input, replace, count, NULL, CREG_DEFAULT)
-cstr cregex_replace_sv_6(const cregex* re, csview input, const char* replace, unsigned count,
+cstr cregex_replace_sv_6(const cregex* re, csview input, const char* replace, int count,
bool (*mfun)(int i, csview match, cstr* mstr), int rflags);
/* replace input with replace using regular expression */
#define cregex_replace(...) c_MACRO_OVERLOAD(cregex_replace, __VA_ARGS__)
-#define cregex_replace_3(re, input, replace) cregex_replace_4(re, input, replace, ~0U)
+#define cregex_replace_3(re, input, replace) cregex_replace_4(re, input, replace, INT32_MAX)
-STC_INLINE cstr cregex_replace_4(const cregex* re, const char* input, const char* replace, unsigned count) {
+STC_INLINE cstr cregex_replace_4(const cregex* re, const char* input, const char* replace, int count) {
csview sv = {input, c_strlen(input)};
return cregex_replace_sv_4(re, sv, replace, count);
}
@@ -150,10 +150,10 @@ STC_INLINE cstr cregex_replace_4(const cregex* re, const char* input, const char
/* replace + compile RE pattern, and extra arguments */
#define cregex_replace_pattern(...) c_MACRO_OVERLOAD(cregex_replace_pattern, __VA_ARGS__)
#define cregex_replace_pattern_3(pattern, input, replace) \
- cregex_replace_pattern_4(pattern, input, replace, ~0U)
+ cregex_replace_pattern_4(pattern, input, replace, INT32_MAX)
#define cregex_replace_pattern_4(pattern, input, replace, count) \
cregex_replace_pattern_6(pattern, input, replace, count, NULL, CREG_DEFAULT)
-cstr cregex_replace_pattern_6(const char* pattern, const char* input, const char* replace, unsigned count,
+cstr cregex_replace_pattern_6(const char* pattern, const char* input, const char* replace, int count,
bool (*mfun)(int i, csview match, cstr* mstr), int crflags);
/* destroy regex */
diff --git a/include/stc/csmap.h b/include/stc/csmap.h
index b92d25d8..de948618 100644
--- a/include/stc/csmap.h
+++ b/include/stc/csmap.h
@@ -107,7 +107,7 @@ STC_API _cx_self _cx_memb(_init)(void);
STC_API _cx_result _cx_memb(_insert)(_cx_self* self, i_key key _i_MAP_ONLY(, i_val mapped));
STC_API _cx_result _cx_memb(_push)(_cx_self* self, _cx_value _val);
STC_API void _cx_memb(_drop)(_cx_self* self);
-STC_API bool _cx_memb(_reserve)(_cx_self* self, size_t cap);
+STC_API bool _cx_memb(_reserve)(_cx_self* self, intptr_t cap);
STC_API _cx_value* _cx_memb(_find_it)(const _cx_self* self, _cx_rawkey rkey, _cx_iter* out);
STC_API _cx_iter _cx_memb(_lower_bound)(const _cx_self* self, _cx_rawkey rkey);
STC_API _cx_value* _cx_memb(_front)(const _cx_self* self);
@@ -118,8 +118,8 @@ STC_API _cx_iter _cx_memb(_erase_range)(_cx_self* self, _cx_iter it1, _cx
STC_API void _cx_memb(_next)(_cx_iter* it);
STC_INLINE bool _cx_memb(_empty)(const _cx_self* cx) { return cx->size == 0; }
-STC_INLINE size_t _cx_memb(_size)(const _cx_self* cx) { return cx->size; }
-STC_INLINE size_t _cx_memb(_capacity)(const _cx_self* cx) { return cx->cap; }
+STC_INLINE intptr_t _cx_memb(_size)(const _cx_self* cx) { return cx->size; }
+STC_INLINE intptr_t _cx_memb(_capacity)(const _cx_self* cx) { return cx->cap; }
STC_INLINE _cx_iter _cx_memb(_find)(const _cx_self* self, _cx_rawkey rkey)
{ _cx_iter it; _cx_memb(_find_it)(self, rkey, &it); return it; }
STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, _cx_rawkey rkey)
@@ -130,7 +130,7 @@ STC_INLINE _cx_value* _cx_memb(_get_mut)(_cx_self* self, _cx_rawkey rkey)
{ _cx_iter it; return _cx_memb(_find_it)(self, rkey, &it); }
STC_INLINE _cx_self
-_cx_memb(_with_capacity)(const size_t cap) {
+_cx_memb(_with_capacity)(const intptr_t cap) {
_cx_self tree = _cx_memb(_init)();
_cx_memb(_reserve)(&tree, cap);
return tree;
@@ -225,10 +225,10 @@ _cx_memb(_init)(void) {
}
STC_DEF bool
-_cx_memb(_reserve)(_cx_self* self, const size_t cap) {
+_cx_memb(_reserve)(_cx_self* self, const intptr_t cap) {
if (cap <= self->cap)
return false;
- _cx_node* nodes = (_cx_node*)c_realloc(self->nodes, (cap + 1)*sizeof(_cx_node));
+ _cx_node* nodes = (_cx_node*)c_realloc(self->nodes, (cap + 1)*c_sizeof(_cx_node));
if (!nodes)
return false;
nodes[0] = c_LITERAL(_cx_node){{0, 0}, 0};
@@ -294,7 +294,7 @@ _cx_memb(_push)(_cx_self* self, _cx_value _val) {
return _res;
}
-STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, size_t n) {
+STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, intptr_t n) {
while (n--)
#if defined _i_isset && defined i_no_emplace
_cx_memb(_insert)(self, *raw++);
@@ -307,7 +307,7 @@ STC_INLINE void _cx_memb(_put_n)(_cx_self* self, const _cx_raw* raw, size_t n) {
#endif
}
-STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, size_t n)
+STC_INLINE _cx_self _cx_memb(_from_n)(const _cx_raw* raw, intptr_t n)
{ _cx_self cx = {0}; _cx_memb(_put_n)(&cx, raw, n); return cx; }
#ifndef _i_isset
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index 97d5256c..dd4686e9 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -185,7 +185,7 @@ STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
STC_INLINE void _cx_memb(_next)(_cx_iter* it)
{ if (++it->ref == it->end) it->ref = NULL; }
-STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, intptr_t n)
+STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t n)
{ if ((it.ref += n) >= it.end) it.ref = NULL ; return it; }
#include "priv/template.h"
diff --git a/include/stc/cstr.h b/include/stc/cstr.h
index f965487c..2966db81 100644
--- a/include/stc/cstr.h
+++ b/include/stc/cstr.h
@@ -374,7 +374,7 @@ STC_INLINE char* cstr_append_s(cstr* self, cstr s) {
}
#define cstr_replace(...) c_MACRO_OVERLOAD(cstr_replace, __VA_ARGS__)
-#define cstr_replace_3(self, search, repl) cstr_replace_4(self, search, repl, ~0U)
+#define cstr_replace_3(self, search, repl) cstr_replace_4(self, search, repl, INT32_MAX)
STC_INLINE void cstr_replace_4(cstr* self, const char* search, const char* repl, int32_t count) {
cstr_take(self, cstr_replace_sv(cstr_sv(self), c_SV(search, c_strlen(search)),
c_SV(repl, c_strlen(repl)), count));
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 11d145e6..06664b4d 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -208,7 +208,7 @@ STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
STC_INLINE void _cx_memb(_next)(_cx_iter* it)
{ if (++it->ref == it->end) it->ref = NULL; }
-STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, intptr_t n)
+STC_INLINE _cx_iter _cx_memb(_advance)(_cx_iter it, size_t n)
{ if ((it.ref += n) >= it.end) it.ref = NULL; return it; }
STC_INLINE intptr_t _cx_memb(_index)(const _cx_self* self, _cx_iter it)
diff --git a/include/stc/forward.h b/include/stc/forward.h
index dfb43a9f..594c76fa 100644
--- a/include/stc/forward.h
+++ b/include/stc/forward.h
@@ -26,17 +26,15 @@
#include <stdint.h>
#define forward_carc(CX, VAL) _c_carc_types(CX, VAL)
-#define forward_carr2(CX, VAL) _c_carr2_types(CX, VAL)
-#define forward_carr3(CX, VAL) _c_carr3_types(CX, VAL)
#define forward_cbox(CX, VAL) _c_cbox_types(CX, VAL)
#define forward_cdeq(CX, VAL) _c_cdeq_types(CX, VAL)
#define forward_clist(CX, VAL) _c_clist_types(CX, VAL)
-#define forward_cmap(CX, KEY, VAL) _c_chash_types(CX, KEY, VAL, uint32_t, c_true, c_false)
-#define forward_cmap_huge(CX, KEY, VAL) _c_chash_types(CX, KEY, VAL, size_t, c_true, c_false)
-#define forward_cset(CX, KEY) _c_chash_types(CX, cset, KEY, KEY, uint32_t, c_false, c_true)
-#define forward_cset_huge(CX, KEY) _c_chash_types(CX, cset, KEY, KEY, size_t, c_false, c_true)
-#define forward_csmap(CX, KEY, VAL) _c_aatree_types(CX, KEY, VAL, uint32_t, c_true, c_false)
-#define forward_csset(CX, KEY) _c_aatree_types(CX, KEY, KEY, uint32_t, c_false, c_true)
+#define forward_cmap(CX, KEY, VAL) _c_chash_types(CX, KEY, VAL, int32_t, c_true, c_false)
+#define forward_cmap_huge(CX, KEY, VAL) _c_chash_types(CX, KEY, VAL, intptr_t, c_true, c_false)
+#define forward_cset(CX, KEY) _c_chash_types(CX, cset, KEY, KEY, int32_t, c_false, c_true)
+#define forward_cset_huge(CX, KEY) _c_chash_types(CX, cset, KEY, KEY, intptr_t, c_false, c_true)
+#define forward_csmap(CX, KEY, VAL) _c_aatree_types(CX, KEY, VAL, int32_t, c_true, c_false)
+#define forward_csset(CX, KEY) _c_aatree_types(CX, KEY, KEY, int32_t, c_false, c_true)
#define forward_cstack(CX, VAL) _c_cstack_types(CX, VAL)
#define forward_cpque(CX, VAL) _c_cpque_types(CX, VAL)
#define forward_cqueue(CX, VAL) _c_cdeq_types(CX, VAL)
diff --git a/include/stc/priv/template.h b/include/stc/priv/template.h
index 9634fe2c..4aa54bcc 100644
--- a/include/stc/priv/template.h
+++ b/include/stc/priv/template.h
@@ -47,7 +47,7 @@
#ifdef i_size
#define _i_expandby 2
#else
- #define i_size uint32_t
+ #define i_size int32_t
#define _i_expandby 1
#endif
diff --git a/include/stc/utf8.h b/include/stc/utf8.h
index ce50af87..da738fc6 100644
--- a/include/stc/utf8.h
+++ b/include/stc/utf8.h
@@ -25,7 +25,7 @@ extern bool utf8_iscased(uint32_t c);
extern bool utf8_isword(uint32_t c);
extern bool utf8_valid_n(const char* s, intptr_t nbytes);
extern int utf8_icmp_sv(csview s1, csview s2);
-extern unsigned utf8_encode(char *out, uint32_t c);
+extern int utf8_encode(char *out, uint32_t c);
extern uint32_t utf8_peek_off(const char *s, int offset);
STC_INLINE bool utf8_isupper(uint32_t c)
@@ -45,7 +45,7 @@ STC_INLINE bool utf8_isblank(uint32_t c) {
}
STC_INLINE bool utf8_isspace(uint32_t c) {
- if (c < 128) return isspace(c) != 0;
+ if (c < 128) return isspace((int)c) != 0;
return ((c == 8232) | (c == 8233)) || utf8_isgroup(U8G_Zs, c);
}