NouVeL/NVL/Common.h

36 lines
833 B
C
Raw Permalink Normal View History

2021-12-17 01:05:38 -05:00
#pragma once
2022-08-18 12:17:43 -04:00
#include <cstdint>
static_assert(sizeof(float) == 4);
static_assert(sizeof(double) == 8);
2022-08-18 12:17:43 -04:00
typedef float f32;
typedef double f64;
typedef int8_t i8;
typedef uint8_t u8;
typedef int16_t i16;
typedef uint16_t u16;
typedef int32_t i32;
typedef uint32_t u32;
typedef int64_t i64;
typedef uint64_t u64;
#include <string>
2023-04-07 16:04:30 -04:00
#include <vector>
2022-08-18 12:17:43 -04:00
2022-08-22 02:15:25 -04:00
#include <locale>
#include <codecvt>
2021-12-17 01:05:38 -05:00
namespace NVL {
2022-08-18 12:17:43 -04:00
using Number = f32;
2022-08-22 02:15:25 -04:00
using Char = char16_t;
using String = std::u16string;
2023-04-07 16:04:30 -04:00
template <typename T>
using Vector = std::vector<T>;
2022-08-22 02:15:25 -04:00
static std::wstring_convert<std::codecvt_utf8_utf16<Char>, Char> str_converter;
inline static std::string to_std_string(const String& s) noexcept { return str_converter.to_bytes(s); }
inline static String to_NVL_string(const std::string& s) noexcept { return str_converter.from_bytes(s); }
2021-12-17 01:05:38 -05:00
}