diff --git a/ostd/context_stack.hh b/ostd/context_stack.hh index a56cb95..cfba4cd 100644 --- a/ostd/context_stack.hh +++ b/ostd/context_stack.hh @@ -21,7 +21,6 @@ #include #include -#include "ostd/types.hh" #include "ostd/platform.hh" #if !defined(OSTD_PLATFORM_POSIX) && !defined(OSTD_PLATFORM_WIN32) @@ -181,7 +180,7 @@ struct basic_fixedsize_stack { detail::stack_protect(p, pgs); } - stack_context ret{static_cast(p) + asize, asize}; + stack_context ret{static_cast(p) + asize, asize}; #ifdef OSTD_USE_VALGRIND ret.valgrind_id = VALGRIND_STACK_REGISTER(ret.ptr, p); #endif @@ -196,7 +195,9 @@ struct basic_fixedsize_stack { #ifdef OSTD_USE_VALGRIND VALGRIND_STACK_DEREGISTER(st.valgrind_id); #endif - detail::stack_free(static_cast(st.ptr) - st.size, st.size); + detail::stack_free( + static_cast(st.ptr) - st.size, st.size + ); st.ptr = nullptr; } diff --git a/ostd/coroutine.hh b/ostd/coroutine.hh index 9c8a336..da3334c 100644 --- a/ostd/coroutine.hh +++ b/ostd/coroutine.hh @@ -29,7 +29,6 @@ #include #include "ostd/platform.hh" -#include "ostd/types.hh" #include "ostd/range.hh" #include "ostd/context_stack.hh" @@ -268,8 +267,10 @@ protected: p_stack = sa.allocate(); void *sp = get_stack_ptr(); - size_t asize = p_stack.size - - (static_cast(p_stack.ptr) - static_cast(sp)); + size_t asize = p_stack.size - ( + static_cast(p_stack.ptr) - + static_cast(sp) + ); p_coro = detail::ostd_make_fcontext(sp, asize, &context_call); new (sp) SA(std::move(sa)); @@ -287,7 +288,7 @@ private: */ constexpr size_t sasize = sizeof(SA); - void *sp = static_cast(p_stack.ptr) - sasize - salign; + void *sp = static_cast(p_stack.ptr) - sasize - salign; size_t space = sasize + salign; sp = std::align(salign, sasize, sp, space); diff --git a/ostd/event.hh b/ostd/event.hh index 3136458..be0f08f 100644 --- a/ostd/event.hh +++ b/ostd/event.hh @@ -20,7 +20,7 @@ namespace detail { p_class(ev.p_class), p_nfuncs(ev.p_nfuncs) { using func_t = std::function; - byte *bufp = new byte[sizeof(func_t) * p_nfuncs]; + auto *bufp = new unsigned char[sizeof(func_t) * p_nfuncs]; func_t *nbuf = reinterpret_cast(bufp); for (size_t i = 0; i < p_nfuncs; ++i) new (&nbuf[i]) func_t(ev.p_funcs[i]); @@ -37,7 +37,7 @@ namespace detail { using func_t = std::function; p_class = ev.p_class; p_nfuncs = ev.p_nfuncs; - byte *bufp = new byte[sizeof(func_t) * p_nfuncs]; + auto *bufp = new unsigned char[sizeof(func_t) * p_nfuncs]; func_t *nbuf = reinterpret_cast(bufp); for (size_t i = 0; i < p_nfuncs; ++i) { new (&nbuf[i]) func_t(ev.p_funcs[i]); @@ -58,7 +58,7 @@ namespace detail { using func = std::function; p_funcs[i].~func(); } - delete[] reinterpret_cast(p_funcs); + delete[] reinterpret_cast(p_funcs); p_funcs = nullptr; p_nfuncs = 0; } @@ -72,14 +72,14 @@ namespace detail { return i; } } - byte *bufp = new byte[sizeof(func_t) * (p_nfuncs + 1)]; + auto *bufp = new unsigned char[sizeof(func_t) * (p_nfuncs + 1)]; func_t *nbuf = reinterpret_cast(bufp); for (size_t i = 0; i < p_nfuncs; ++i) { new (&nbuf[i]) func_t(std::move(p_funcs[i])); p_funcs[i].~func_t(); } new (&nbuf[p_nfuncs]) func_t(std::forward(func)); - delete[] reinterpret_cast(p_funcs); + delete[] reinterpret_cast(p_funcs); p_funcs = nbuf; return p_nfuncs++; } diff --git a/ostd/format.hh b/ostd/format.hh index 1f1a18b..7f6b38c 100644 --- a/ostd/format.hh +++ b/ostd/format.hh @@ -131,7 +131,7 @@ namespace detail { * 7 .. string * 8 .. custom object */ - static constexpr byte const fmt_specs[] = { + static constexpr unsigned char const fmt_specs[] = { /* uppercase spec set */ 1, 3, 8, 8, /* A B C D */ 1, 1, 1, 8, /* E F G H */ @@ -689,7 +689,7 @@ struct format_spec { * conventions on this. If the position was not specified, this just * returns 0. */ - byte index() const { return p_index; } + unsigned char index() const { return p_index; } /** @brief Gets the inner part of a range or tuple format specifier. * @@ -769,7 +769,7 @@ private: char p_spec = '\0'; - byte p_index = 0; + unsigned char p_index = 0; bool p_is_tuple = false; bool p_is_nested = false; @@ -870,7 +870,7 @@ private: if (ndig <= 0) return false; /* no pos given */ int idx = atoi(p_buf); if (idx <= 0 || idx > 255) return false; /* bad index */ - p_index = byte(idx); + p_index = static_cast(idx); p_fmt.pop_front(); havepos = true; } @@ -1019,7 +1019,7 @@ private: if (isp == 's') { isp = (ptr ? 'x' : 'd'); } - byte specn = detail::fmt_specs[isp - 65]; + unsigned char specn = detail::fmt_specs[isp - 65]; if (specn <= 2 || specn > 7) { throw format_error{"cannot format integers with the given spec"}; } @@ -1102,7 +1102,7 @@ private: template void write_float(R &writer, T val) const { char isp = spec(); - byte specn = detail::fmt_specs[isp - 65]; + unsigned char specn = detail::fmt_specs[isp - 65]; if (specn != 1 && specn != 7) { throw format_error{"cannot format floats with the given spec"}; } diff --git a/ostd/range.hh b/ostd/range.hh index ae6f0b2..8474230 100644 --- a/ostd/range.hh +++ b/ostd/range.hh @@ -17,8 +17,6 @@ #include #include -#include "ostd/types.hh" - namespace ostd { struct input_range_tag {}; diff --git a/ostd/stream.hh b/ostd/stream.hh index 86e9d65..0cef044 100644 --- a/ostd/stream.hh +++ b/ostd/stream.hh @@ -18,7 +18,6 @@ #endif #include "ostd/platform.hh" -#include "ostd/types.hh" #include "ostd/range.hh" #include "ostd/string.hh" #include "ostd/format.hh" @@ -77,13 +76,13 @@ struct stream { virtual void write_bytes(void const *, size_t) {} virtual int get_char() { - byte c; + unsigned char c; read_bytes(&c, 1); return c; } virtual void put_char(int c) { - byte wc = byte(c); + unsigned char wc = static_cast(c); write_bytes(&wc, 1); } diff --git a/ostd/types.hh b/ostd/types.hh deleted file mode 100644 index d70e272..0000000 --- a/ostd/types.hh +++ /dev/null @@ -1,34 +0,0 @@ -/* Core type aliases for OctaSTD. - * - * This file is part of OctaSTD. See COPYING.md for futher information. - */ - -#ifndef OSTD_TYPES_HH -#define OSTD_TYPES_HH - -#include -#include - -namespace ostd { - -/* "builtin" types */ - -using sbyte = signed char; -using byte = unsigned char; -using ushort = unsigned short; -using uint = unsigned int; -using ulong = unsigned long; -using ullong = unsigned long long; -using llong = long long; - -using ldouble = long double; - -/* used occasionally for template variables */ - -namespace detail { - template struct undef_t; -} - -} - -#endif diff --git a/ostd/vecmath.hh b/ostd/vecmath.hh index edc1c00..9714a95 100644 --- a/ostd/vecmath.hh +++ b/ostd/vecmath.hh @@ -6,8 +6,6 @@ #ifndef OSTD_VECMATH_HH #define OSTD_VECMATH_HH -#include "ostd/types.hh" - namespace ostd { template @@ -132,7 +130,7 @@ inline vec2 operator-(vec2 const &a) { using vec2f = vec2; using vec2d = vec2; -using vec2b = vec2; +using vec2b = vec2; using vec2i = vec2; template @@ -258,7 +256,7 @@ inline vec3 operator-(vec3 const &a) { using vec3f = vec3; using vec3d = vec3; -using vec3b = vec3; +using vec3b = vec3; using vec3i = vec3; template @@ -384,7 +382,7 @@ inline vec4 operator-(vec4 const &a) { using vec4f = vec4; using vec4d = vec4; -using vec4b = vec4; +using vec4b = vec4; using vec4i = vec4; } /* namespace ostd */