From 1c5c0939e163a7d9f72ed9af29b99832d9a8ef84 Mon Sep 17 00:00:00 2001 From: q66 Date: Wed, 25 Jan 2017 02:09:50 +0100 Subject: [PATCH] use size_t --- include/cubescript/cubescript.hh | 46 ++++++++++++++++---------------- src/cs_gen.cc | 34 +++++++++++------------ src/cs_util.cc | 8 +++--- src/cs_vm.cc | 8 +++--- src/cs_vm.hh | 18 ++++++------- src/cubescript.cc | 14 +++++----- src/lib_list.cc | 22 +++++++-------- src/lib_math.cc | 22 +++++++-------- src/lib_str.cc | 6 ++--- 9 files changed, 89 insertions(+), 89 deletions(-) diff --git a/include/cubescript/cubescript.hh b/include/cubescript/cubescript.hh index 831cd58..7235356 100644 --- a/include/cubescript/cubescript.hh +++ b/include/cubescript/cubescript.hh @@ -111,7 +111,7 @@ struct OSTD_EXPORT CsValue { private: ostd::AlignedUnion<1, CsInt, CsFloat, void *> p_stor; - ostd::Size p_len; + size_t p_len; CsValueType p_type; }; @@ -338,13 +338,13 @@ enum { }; using CsHookCb = ostd::Function; -using CsAllocCb = void *(*)(void *, void *, ostd::Size, ostd::Size); +using CsAllocCb = void *(*)(void *, void *, size_t, size_t); enum class CsLoopState { Normal = 0, Break, Continue }; -static inline void *cs_default_alloc(void *, void *p, ostd::Size, ostd::Size ns) { +static inline void *cs_default_alloc(void *, void *p, size_t, size_t ns) { if (!ns) { delete[] static_cast(p); return nullptr; @@ -519,7 +519,7 @@ struct OSTD_EXPORT CsState { private: CsIdent *add_ident(CsIdent *id); - void *alloc(void *ptr, ostd::Size olds, ostd::Size news); + void *alloc(void *ptr, size_t olds, size_t news); template struct CsAllocator { @@ -538,10 +538,10 @@ private: template CsAllocator(CsAllocator const &a) noexcept: p_state(a.p_state) {} - T *allocate(ostd::Size n) { + T *allocate(size_t n) { return static_cast(p_state.alloc(nullptr, 0, n * sizeof(T))); } - void deallocate(T *p, ostd::Size n) noexcept { + void deallocate(T *p, size_t n) noexcept { p_state.alloc(p, n * sizeof(T), 0); } @@ -626,7 +626,7 @@ struct CsErrorException { auto ret = ostd::format( ostd::CharRange(fbuf, sizeof(fbuf)), msg, std::forward(args)... ); - if ((ret < 0) || (ostd::Size(ret) > sizeof(fbuf))) { + if ((ret < 0) || (size_t(ret) > sizeof(fbuf))) { p_errmsg = save_msg(cs, msg); } else { p_errmsg = save_msg(cs, ostd::CharRange(fbuf, ret)); @@ -670,8 +670,8 @@ private: namespace util { template - inline ostd::Size escape_string(R &&writer, ostd::ConstCharRange str) { - ostd::Size ret = 2; + inline size_t escape_string(R &&writer, ostd::ConstCharRange str) { + size_t ret = 2; writer.put('"'); for (; !str.empty(); str.pop_front()) { switch (str.front()) { @@ -700,8 +700,8 @@ namespace util { } template - inline ostd::Size unescape_string(R &&writer, ostd::ConstCharRange str) { - ostd::Size ret = 0; + inline size_t unescape_string(R &&writer, ostd::ConstCharRange str) { + size_t ret = 0; for (; !str.empty(); str.pop_front()) { if (str.front() == '^') { str.pop_front(); @@ -749,13 +749,13 @@ namespace util { } OSTD_EXPORT ostd::ConstCharRange parse_string( - CsState &cs, ostd::ConstCharRange str, ostd::Size &nlines + CsState &cs, ostd::ConstCharRange str, size_t &nlines ); inline ostd::ConstCharRange parse_string( CsState &cs, ostd::ConstCharRange str ) { - ostd::Size nlines; + size_t nlines; return parse_string(cs, str, nlines); } @@ -771,10 +771,10 @@ namespace util { void skip(); bool parse(); - ostd::Size count(); + size_t count(); template - ostd::Size get_item(R &&writer) const { + size_t get_item(R &&writer) const { if (!p_quote.empty() && (*p_quote == '"')) { return unescape_string(std::forward(writer), p_item); } else { @@ -821,12 +821,12 @@ private: } template - inline ostd::Size tvals_concat( + inline size_t tvals_concat( R &&writer, CsValueRange vals, ostd::ConstCharRange sep = ostd::ConstCharRange() ) { - ostd::Size ret = 0; - for (ostd::Size i = 0; i < vals.size(); ++i) { + size_t ret = 0; + for (size_t i = 0; i < vals.size(); ++i) { auto s = ostd::appender(); switch (vals[i].get_type()) { case CsValueType::Int: { @@ -834,7 +834,7 @@ private: std::forward(writer), vals[i].get_int() ); if (r > 0) { - ret += ostd::Size(r); + ret += size_t(r); } break; } @@ -843,7 +843,7 @@ private: std::forward(writer), vals[i].get_float() ); if (r > 0) { - ret += ostd::Size(r); + ret += size_t(r); } break; } @@ -866,8 +866,8 @@ private: } template - inline ostd::Size print_stack(R &&writer, CsStackState const &st) { - ostd::Size ret = 0; + inline size_t print_stack(R &&writer, CsStackState const &st) { + size_t ret = 0; auto nd = st.get(); while (nd) { auto rt = ostd::format( @@ -877,7 +877,7 @@ private: nd->index, nd->id->get_name() ); if (rt > 0) { - ret += ostd::Size(rt); + ret += size_t(rt); } else { return ret; } diff --git a/src/cs_gen.cc b/src/cs_gen.cc index 4835176..0550f72 100644 --- a/src/cs_gen.cc +++ b/src/cs_gen.cc @@ -10,7 +10,7 @@ namespace cscript { ostd::ConstCharRange GenState::get_str() { - ostd::Size nl; + size_t nl; ostd::ConstCharRange beg = source; source = util::parse_string(cs, source, nl); current_line += nl - 1; @@ -109,8 +109,8 @@ static inline int cs_ret_code(int type, int def = 0) { static void compilestatements( GenState &gs, int rettype, int brak = '\0', int prevargs = 0 ); -static inline ostd::Pair compileblock( - GenState &gs, ostd::ConstCharRange p, ostd::Size line, +static inline ostd::Pair compileblock( + GenState &gs, ostd::ConstCharRange p, size_t line, int rettype = CsRetNull, int brak = '\0' ); @@ -172,16 +172,16 @@ static inline void compileblock(GenState &gs) { gs.code.push_back(CsCodeEmpty); } -static inline ostd::Pair compileblock( - GenState &gs, ostd::ConstCharRange p, ostd::Size line, int rettype, int brak +static inline ostd::Pair compileblock( + GenState &gs, ostd::ConstCharRange p, size_t line, int rettype, int brak ) { - ostd::Size start = gs.code.size(); + size_t start = gs.code.size(); gs.code.push_back(CsCodeBlock); gs.code.push_back(CsCodeOffset | ((start + 2) << 8)); - ostd::Size retline = line; + size_t retline = line; if (p) { ostd::ConstCharRange op = gs.source; - ostd::Size oldline = gs.current_line; + size_t oldline = gs.current_line; gs.source = p; gs.current_line = line; compilestatements(gs, CsValAny, brak); @@ -209,7 +209,7 @@ static inline void compileunescapestr(GenState &gs, bool macro = false) { size_t bufs = (gs.code.capacity() - gs.code.size()) * sizeof(ostd::Uint32); char *buf = new char[bufs + 1]; auto writer = ostd::CharRange(buf, bufs); - ostd::Size len = util::unescape_string(writer, str); + size_t len = util::unescape_string(writer, str); memset(&buf[len], 0, sizeof(ostd::Uint32) - len % sizeof(ostd::Uint32)); gs.code.back() |= len << 8; uint32_t *ubuf = reinterpret_cast(buf); @@ -587,7 +587,7 @@ done: static void compileblockmain(GenState &gs, int wordtype, int prevargs) { char const *start = gs.source.data(); - ostd::Size curline = gs.current_line; + size_t curline = gs.current_line; int concs = 0; for (int brak = 1; brak;) { switch (gs.skip_until("@\"/[]")) { @@ -763,7 +763,7 @@ static bool compilearg( gs.get_str(); break; case CsValCond: { - ostd::Size line = gs.current_line; + size_t line = gs.current_line; auto s = gs.get_str_dup(); if (!s.empty()) { compileblock(gs, s, line); @@ -791,7 +791,7 @@ static bool compilearg( compileunescapestr(gs, true); break; default: { - ostd::Size line = gs.current_line; + size_t line = gs.current_line; auto s = gs.get_str_dup(); gs.gen_value(wordtype, s, line); break; @@ -810,7 +810,7 @@ static bool compilearg( ); gs.code.push_back(CsCodeExit | cs_ret_code(wordtype)); } else { - ostd::Size start = gs.code.size(); + size_t start = gs.code.size(); compilestatements( gs, wordtype > CsValAny ? CsValCany : CsValAny, ')', prevargs ); @@ -846,7 +846,7 @@ static bool compilearg( return !gs.get_word().empty(); } case CsValCond: { - ostd::Size line = gs.current_line; + size_t line = gs.current_line; auto s = gs.get_word(); if (s.empty()) { return false; @@ -855,7 +855,7 @@ static bool compilearg( return true; } case CsValCode: { - ostd::Size line = gs.current_line; + size_t line = gs.current_line; auto s = gs.get_word(); if (s.empty()) { return false; @@ -871,7 +871,7 @@ static bool compilearg( return !w.empty(); } default: { - ostd::Size line = gs.current_line; + size_t line = gs.current_line; auto s = gs.get_word(); if (s.empty()) { return false; @@ -1256,7 +1256,7 @@ static void compilestatements(GenState &gs, int rettype, int brak, int prevargs) for (;;) { gs.skip_comments(); idname.clear(); - ostd::Size curline = gs.current_line; + size_t curline = gs.current_line; bool more = compilearg(gs, CsValWord, prevargs, &idname); if (!more) { goto endstatement; diff --git a/src/cs_util.cc b/src/cs_util.cc index 2dc269f..368bbba 100644 --- a/src/cs_util.cc +++ b/src/cs_util.cc @@ -185,9 +185,9 @@ done: namespace util { OSTD_EXPORT ostd::ConstCharRange parse_string( - CsState &cs, ostd::ConstCharRange str, ostd::Size &nlines + CsState &cs, ostd::ConstCharRange str, size_t &nlines ) { - ostd::Size nl = 0; + size_t nl = 0; nlines = nl; if (str.empty() || (*str != '\"')) { return str; @@ -370,8 +370,8 @@ endblock: return true; } - ostd::Size ListParser::count() { - ostd::Size ret = 0; + size_t ListParser::count() { + size_t ret = 0; while (parse()) { ++ret; } diff --git a/src/cs_vm.cc b/src/cs_vm.cc index cf71ed0..32ce743 100644 --- a/src/cs_vm.cc +++ b/src/cs_vm.cc @@ -47,7 +47,7 @@ CsStackState::CsStackState(CsStackState &&st): } CsStackState::~CsStackState() { - ostd::Size len = 0; + size_t len = 0; for (CsStackStateNode const *nd = p_node; nd; nd = nd->next) { ++len; } @@ -1525,7 +1525,7 @@ noid: continue; case CsIdLocal: { CsIdentStack locals[MaxArguments]; - for (ostd::Size j = 0; j < ostd::Size(callargs); ++j) { + for (size_t j = 0; j < size_t(callargs); ++j) { cs_push_alias(cs.force_ident( args[offset + j] ), locals[j]); @@ -1533,7 +1533,7 @@ noid: cs_do_and_cleanup([&]() { code = runcode(cs, code, result); }, [&]() { - for (ostd::Size j = 0; j < ostd::Size(callargs); ++j) { + for (size_t j = 0; j < size_t(callargs); ++j) { cs_pop_alias(args[offset + j].get_ident()); } }); @@ -1810,7 +1810,7 @@ static bool cs_run_file( CsState &cs, ostd::ConstCharRange fname, CsValue &ret ) { ostd::Box buf; - ostd::Size len; + size_t len; ostd::FileStream f(fname, ostd::StreamMode::read); if (!f.is_open()) { diff --git a/src/cs_vm.hh b/src/cs_vm.hh index 96dcce2..be1e239 100644 --- a/src/cs_vm.hh +++ b/src/cs_vm.hh @@ -100,7 +100,7 @@ struct CsSharedState { CsAllocCb allocf; void *aptr; - void *alloc(void *ptr, ostd::Size os, ostd::Size ns) { + void *alloc(void *ptr, size_t os, size_t ns) { return allocf(aptr, ptr, os, ns); } @@ -112,9 +112,9 @@ struct CsSharedState { } template - T *create_array(ostd::Size len) { + T *create_array(size_t len) { T *ret = static_cast(alloc(nullptr, 0, len * sizeof(T))); - for (ostd::Size i = 0; i < len; ++i) { + for (size_t i = 0; i < len; ++i) { new (&ret[i]) T(); } return ret; @@ -127,7 +127,7 @@ struct CsSharedState { } template - void destroy_array(T *v, ostd::Size len) noexcept { + void destroy_array(T *v, size_t len) noexcept { v->~T(); alloc(v, len * sizeof(T), 0); } @@ -140,7 +140,7 @@ struct CsContinueException { }; template -constexpr ostd::Size CsTypeStorageSize = +constexpr size_t CsTypeStorageSize = (sizeof(T) - 1) / sizeof(ostd::Uint32) + 1; struct GenState { @@ -149,7 +149,7 @@ struct GenState { bool parsing = true; CsVector code; ostd::ConstCharRange source; - ostd::Size current_line; + size_t current_line; ostd::ConstCharRange src_name; GenState() = delete; @@ -180,7 +180,7 @@ struct GenState { void gen_str(ostd::ConstCharRange word, bool macro = false) { if (word.size() <= 3 && !macro) { ostd::Uint32 op = CsCodeValInt | CsRetString; - for (ostd::Size i = 0; i < word.size(); ++i) { + for (size_t i = 0; i < word.size(); ++i) { op |= ostd::Uint32(ostd::byte(word[i])) << ((i + 1) * 8); } code.push_back(op); @@ -193,7 +193,7 @@ struct GenState { code.insert( code.end(), it, it + (word.size() / sizeof(ostd::Uint32)) ); - ostd::Size esz = word.size() % sizeof(ostd::Uint32); + size_t esz = word.size() % sizeof(ostd::Uint32); union { char c[sizeof(ostd::Uint32)]; ostd::Uint32 u; @@ -277,7 +277,7 @@ struct GenState { source.pop_front(); } - char current(ostd::Size ahead = 0) { + char current(size_t ahead = 0) { if (source.size() <= ahead) { return '\0'; } diff --git a/src/cubescript.cc b/src/cubescript.cc index 71de921..65b94d2 100644 --- a/src/cubescript.cc +++ b/src/cubescript.cc @@ -341,7 +341,7 @@ CsState::CsState(CsAllocCb func, void *data): if (args.empty()) { res.set_int(1); } else { - for (ostd::Size i = 0; i < args.size(); ++i) { + for (size_t i = 0; i < args.size(); ++i) { CsBytecode *code = args[i].get_code(); if (code) { cs.run(code, res); @@ -359,7 +359,7 @@ CsState::CsState(CsAllocCb func, void *data): if (args.empty()) { res.set_int(0); } else { - for (ostd::Size i = 0; i < args.size(); ++i) { + for (size_t i = 0; i < args.size(); ++i) { CsBytecode *code = args[i].get_code(); if (code) { cs.run(code, res); @@ -424,7 +424,7 @@ CsHookCb &CsState::get_call_hook() { return p_callhook; } -void *CsState::alloc(void *ptr, ostd::Size os, ostd::Size ns) { +void *CsState::alloc(void *ptr, size_t os, size_t ns) { return p_state->alloc(ptr, os, ns); } @@ -1073,7 +1073,7 @@ void cs_init_lib_base(CsState &gcs) { }); gcs.new_command("cond", "ee2V", [](auto &cs, auto args, auto &res) { - for (ostd::Size i = 0; i < args.size(); i += 2) { + for (size_t i = 0; i < args.size(); i += 2) { if ((i + 1) < args.size()) { if (cs.run_bool(args[i].get_code())) { cs.run(args[i + 1].get_code(), res); @@ -1088,7 +1088,7 @@ void cs_init_lib_base(CsState &gcs) { gcs.new_command("case", "ite2V", [](auto &cs, auto args, auto &res) { CsInt val = args[0].get_int(); - for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) { + for (size_t i = 1; (i + 1) < args.size(); i += 2) { if ( (args[i].get_type() == CsValueType::Null) || (args[i].get_int() == val) @@ -1101,7 +1101,7 @@ void cs_init_lib_base(CsState &gcs) { gcs.new_command("casef", "fte2V", [](auto &cs, auto args, auto &res) { CsFloat val = args[0].get_float(); - for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) { + for (size_t i = 1; (i + 1) < args.size(); i += 2) { if ( (args[i].get_type() == CsValueType::Null) || (args[i].get_float() == val) @@ -1114,7 +1114,7 @@ void cs_init_lib_base(CsState &gcs) { gcs.new_command("cases", "ste2V", [](auto &cs, auto args, auto &res) { CsString val = args[0].get_str(); - for (ostd::Size i = 1; (i + 1) < args.size(); i += 2) { + for (size_t i = 1; (i + 1) < args.size(); i += 2) { if ( (args[i].get_type() == CsValueType::Null) || (args[i].get_str() == val) diff --git a/src/lib_list.cc b/src/lib_list.cc index 3801bb5..654f1c9 100644 --- a/src/lib_list.cc +++ b/src/lib_list.cc @@ -149,7 +149,7 @@ void cs_init_lib_list(CsState &gcs) { CsString str = std::move(args[0].get_str()); util::ListParser p(cs, str); p.get_raw_item() = str; - for (ostd::Size i = 1; i < args.size(); ++i) { + for (size_t i = 1; i < args.size(); ++i) { p.get_input() = str; CsInt pos = args[i].get_int(); for (; pos > 0; --pos) { @@ -422,8 +422,8 @@ end: auto buf = ostd::appender(); ostd::ConstCharRange s = args[0].get_strr(); ostd::ConstCharRange conj = args[1].get_strr(); - ostd::Size len = util::ListParser(cs, s).count(); - ostd::Size n = 0; + size_t len = util::ListParser(cs, s).count(); + size_t n = 0; for (util::ListParser p(cs, s); p.parse(); ++n) { if (!p.get_raw_item(true).empty() && (p.get_raw_item(true).front() == '"')) { @@ -540,7 +540,7 @@ static void cs_list_sort( CsAlias *xa = static_cast(x), *ya = static_cast(y); CsVector items; - ostd::Size total = 0; + size_t total = 0; for (util::ListParser p(cs, list); p.parse();) { ListSortItem item = { p.get_raw_item(), p.get_raw_item(true) }; @@ -559,8 +559,8 @@ static void cs_list_sort( xval.push(); yval.push(); - ostd::Size totaluniq = total; - ostd::Size nuniq = items.size(); + size_t totaluniq = total; + size_t nuniq = items.size(); if (body) { ListSortFun f = { cs, xval, yval, body }; ostd::sort_cmp(ostd::iter(items), f); @@ -568,7 +568,7 @@ static void cs_list_sort( f.body = unique; totaluniq = items[0].quote.size(); nuniq = 1; - for (ostd::Size i = 1; i < items.size(); i++) { + for (size_t i = 1; i < items.size(); i++) { ListSortItem &item = items[i]; if (f(items[i - 1], item)) { item.quote = nullptr; @@ -582,9 +582,9 @@ static void cs_list_sort( ListSortFun f = { cs, xval, yval, unique }; totaluniq = items[0].quote.size(); nuniq = 1; - for (ostd::Size i = 1; i < items.size(); i++) { + for (size_t i = 1; i < items.size(); i++) { ListSortItem &item = items[i]; - for (ostd::Size j = 0; j < i; ++j) { + for (size_t j = 0; j < i; ++j) { ListSortItem &prev = items[j]; if (!prev.quote.empty() && f(item, prev)) { item.quote = nullptr; @@ -602,8 +602,8 @@ static void cs_list_sort( yval.pop(); CsString sorted; - sorted.reserve(totaluniq + ostd::max(nuniq - 1, ostd::Size(0))); - for (ostd::Size i = 0; i < items.size(); ++i) { + sorted.reserve(totaluniq + ostd::max(nuniq - 1, size_t(0))); + for (size_t i = 0; i < items.size(); ++i) { ListSortItem &item = items[i]; if (item.quote.empty()) { continue; diff --git a/src/lib_math.cc b/src/lib_math.cc index 2c08445..7278fb5 100644 --- a/src/lib_math.cc +++ b/src/lib_math.cc @@ -47,7 +47,7 @@ static inline void cs_mathop( T val; if (args.size() >= 2) { val = binop(CsMathVal::get(args[0]), CsMathVal::get(args[1])); - for (ostd::Size i = 2; i < args.size(); ++i) { + for (size_t i = 2; i < args.size(); ++i) { val = binop(val, CsMathVal::get(args[i])); } } else { @@ -61,7 +61,7 @@ static inline void cs_cmpop(CsValueRange args, CsValue &res, F cmp) { bool val; if (args.size() >= 2) { val = cmp(CsMathVal::get(args[0]), CsMathVal::get(args[1])); - for (ostd::Size i = 2; (i < args.size()) && val; ++i) { + for (size_t i = 2; (i < args.size()) && val; ++i) { val = cmp(CsMathVal::get(args[i - 1]), CsMathVal::get(args[i])); } } else { @@ -178,28 +178,28 @@ void cs_init_lib_math(CsState &cs) { cs.new_command("min", "i1V", [](auto &, auto args, auto &res) { CsInt v = (!args.empty() ? args[0].get_int() : 0); - for (ostd::Size i = 1; i < args.size(); ++i) { + for (size_t i = 1; i < args.size(); ++i) { v = ostd::min(v, args[i].get_int()); } res.set_int(v); }); cs.new_command("max", "i1V", [](auto &, auto args, auto &res) { CsInt v = (!args.empty() ? args[0].get_int() : 0); - for (ostd::Size i = 1; i < args.size(); ++i) { + for (size_t i = 1; i < args.size(); ++i) { v = ostd::max(v, args[i].get_int()); } res.set_int(v); }); cs.new_command("minf", "f1V", [](auto &, auto args, auto &res) { CsFloat v = (!args.empty() ? args[0].get_float() : 0); - for (ostd::Size i = 1; i < args.size(); ++i) { + for (size_t i = 1; i < args.size(); ++i) { v = ostd::min(v, args[i].get_float()); } res.set_float(v); }); cs.new_command("maxf", "f1V", [](auto &, auto args, auto &res) { CsFloat v = (!args.empty() ? args[0].get_float() : 0); - for (ostd::Size i = 1; i < args.size(); ++i) { + for (size_t i = 1; i < args.size(); ++i) { v = ostd::max(v, args[i].get_float()); } res.set_float(v); @@ -271,7 +271,7 @@ void cs_init_lib_math(CsState &cs) { CsInt val; if (args.size() >= 2) { val = args[0].get_int() ^ ~args[1].get_int(); - for (ostd::Size i = 2; i < args.size(); ++i) { + for (size_t i = 2; i < args.size(); ++i) { val ^= ~args[i].get_int(); } } else { @@ -283,7 +283,7 @@ void cs_init_lib_math(CsState &cs) { CsInt val; if (args.size() >= 2) { val = args[0].get_int() & ~args[1].get_int(); - for (ostd::Size i = 2; i < args.size(); ++i) { + for (size_t i = 2; i < args.size(); ++i) { val &= ~args[i].get_int(); } } else { @@ -295,7 +295,7 @@ void cs_init_lib_math(CsState &cs) { CsInt val; if (args.size() >= 2) { val = args[0].get_int() | ~args[1].get_int(); - for (ostd::Size i = 2; i < args.size(); ++i) { + for (size_t i = 2; i < args.size(); ++i) { val |= ~args[i].get_int(); } } else { @@ -307,7 +307,7 @@ void cs_init_lib_math(CsState &cs) { cs.new_command("<<", "i1V", [](auto &, auto args, auto &res) { cs_mathop( args, res, 0, [](CsInt val1, CsInt val2) { - return (val2 < CsInt(ostd::SizeInBits)) + return (val2 < CsInt(size_tInBits)) ? (val1 << ostd::max(val2, CsInt(0))) : 0; }, CsMathNoop() @@ -317,7 +317,7 @@ void cs_init_lib_math(CsState &cs) { cs_mathop( args, res, 0, [](CsInt val1, CsInt val2) { return val1 >> ostd::clamp( - val2, CsInt(0), CsInt(ostd::SizeInBits) + val2, CsInt(0), CsInt(size_tInBits) ); }, CsMathNoop() ); diff --git a/src/lib_str.cc b/src/lib_str.cc index b8f3384..2b38113 100644 --- a/src/lib_str.cc +++ b/src/lib_str.cc @@ -9,7 +9,7 @@ static inline void cs_strgcmp(CsValueRange args, CsValue &res, F cfunc) { bool val; if (args.size() >= 2) { val = cfunc(args[0].get_strr(), args[1].get_strr()); - for (ostd::Size i = 2; (i < args.size()) && val; ++i) { + for (size_t i = 2; (i < args.size()) && val; ++i) { val = cfunc(args[i - 1].get_strr(), args[i].get_strr()); } } else { @@ -108,7 +108,7 @@ void cs_init_lib_string(CsState &cs) { ++f; if (ic >= '1' && ic <= '9') { int i = ic - '0'; - if (ostd::Size(i) < args.size()) { + if (size_t(i) < args.size()) { s += args[i].get_str(); } } else { @@ -178,7 +178,7 @@ void cs_init_lib_string(CsState &cs) { res.set_str(s); return; } - for (ostd::Size i = 0;; ++i) { + for (size_t i = 0;; ++i) { ostd::ConstCharRange found; ostd::ConstCharRange trys = s; for (; oldval.size() <= trys.size(); ++trys) {