forked from OctaForge/libostd
remove types.hh
This commit is contained in:
parent
3b7f54e64c
commit
4a7baa40a0
|
@ -21,7 +21,6 @@
|
|||
#include <new>
|
||||
#include <algorithm>
|
||||
|
||||
#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<byte *>(p) + asize, asize};
|
||||
stack_context ret{static_cast<unsigned char *>(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<byte *>(st.ptr) - st.size, st.size);
|
||||
detail::stack_free(
|
||||
static_cast<unsigned char *>(st.ptr) - st.size, st.size
|
||||
);
|
||||
st.ptr = nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <optional>
|
||||
|
||||
#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<SA>();
|
||||
size_t asize = p_stack.size -
|
||||
(static_cast<byte *>(p_stack.ptr) - static_cast<byte *>(sp));
|
||||
size_t asize = p_stack.size - (
|
||||
static_cast<unsigned char *>(p_stack.ptr) -
|
||||
static_cast<unsigned char *>(sp)
|
||||
);
|
||||
|
||||
p_coro = detail::ostd_make_fcontext(sp, asize, &context_call<C, SA>);
|
||||
new (sp) SA(std::move(sa));
|
||||
|
@ -287,7 +288,7 @@ private:
|
|||
*/
|
||||
constexpr size_t sasize = sizeof(SA);
|
||||
|
||||
void *sp = static_cast<byte *>(p_stack.ptr) - sasize - salign;
|
||||
void *sp = static_cast<unsigned char *>(p_stack.ptr) - sasize - salign;
|
||||
size_t space = sasize + salign;
|
||||
sp = std::align(salign, sasize, sp, space);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace detail {
|
|||
p_class(ev.p_class), p_nfuncs(ev.p_nfuncs)
|
||||
{
|
||||
using func_t = std::function<void(C &, A...)>;
|
||||
byte *bufp = new byte[sizeof(func_t) * p_nfuncs];
|
||||
auto *bufp = new unsigned char[sizeof(func_t) * p_nfuncs];
|
||||
func_t *nbuf = reinterpret_cast<func_t *>(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<void(C &, A...)>;
|
||||
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<func_t *>(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<void(C &, A...)>;
|
||||
p_funcs[i].~func();
|
||||
}
|
||||
delete[] reinterpret_cast<byte *>(p_funcs);
|
||||
delete[] reinterpret_cast<unsigned char *>(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<func_t *>(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<F>(func));
|
||||
delete[] reinterpret_cast<byte *>(p_funcs);
|
||||
delete[] reinterpret_cast<unsigned char *>(p_funcs);
|
||||
p_funcs = nbuf;
|
||||
return p_nfuncs++;
|
||||
}
|
||||
|
|
|
@ -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<unsigned char>(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<typename R, typename T>
|
||||
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"};
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
#include <initializer_list>
|
||||
#include <algorithm>
|
||||
|
||||
#include "ostd/types.hh"
|
||||
|
||||
namespace ostd {
|
||||
|
||||
struct input_range_tag {};
|
||||
|
|
|
@ -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<unsigned char>(c);
|
||||
write_bytes(&wc, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 <stdint.h>
|
||||
#include <cstddef>
|
||||
|
||||
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<typename> struct undef_t;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -6,8 +6,6 @@
|
|||
#ifndef OSTD_VECMATH_HH
|
||||
#define OSTD_VECMATH_HH
|
||||
|
||||
#include "ostd/types.hh"
|
||||
|
||||
namespace ostd {
|
||||
|
||||
template<typename T>
|
||||
|
@ -132,7 +130,7 @@ inline vec2<T> operator-(vec2<T> const &a) {
|
|||
|
||||
using vec2f = vec2<float>;
|
||||
using vec2d = vec2<double>;
|
||||
using vec2b = vec2<byte>;
|
||||
using vec2b = vec2<unsigned char>;
|
||||
using vec2i = vec2<int>;
|
||||
|
||||
template<typename T>
|
||||
|
@ -258,7 +256,7 @@ inline vec3<T> operator-(vec3<T> const &a) {
|
|||
|
||||
using vec3f = vec3<float>;
|
||||
using vec3d = vec3<double>;
|
||||
using vec3b = vec3<byte>;
|
||||
using vec3b = vec3<unsigned char>;
|
||||
using vec3i = vec3<int>;
|
||||
|
||||
template<typename T>
|
||||
|
@ -384,7 +382,7 @@ inline vec4<T> operator-(vec4<T> const &a) {
|
|||
|
||||
using vec4f = vec4<float>;
|
||||
using vec4d = vec4<double>;
|
||||
using vec4b = vec4<byte>;
|
||||
using vec4b = vec4<unsigned char>;
|
||||
using vec4i = vec4<int>;
|
||||
|
||||
} /* namespace ostd */
|
||||
|
|
Loading…
Reference in a new issue