platform
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#pragma message("Compiling for Windows")
|
||||
#define FTB_WINDOWS
|
||||
#elseif
|
||||
#pragma message("Compiling for Linux")
|
||||
#define FTB_LINUX
|
||||
#endif
|
||||
@@ -1,3 +1,5 @@
|
||||
#include "./types.hpp"
|
||||
|
||||
typedef s32 testresult;
|
||||
|
||||
#define epsilon 2.2204460492503131E-16
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "platform.hpp"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -27,10 +28,18 @@ struct String {
|
||||
char* data;
|
||||
};
|
||||
|
||||
inline auto heap_copy_c_string(const char* str) -> char* {
|
||||
#ifdef FTB_WINDOWS
|
||||
return _strdup(str);
|
||||
#else
|
||||
return strdup(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline auto make_heap_string(const char* str) -> String {
|
||||
String ret;
|
||||
ret.length = strlen(str);
|
||||
ret.data = _strdup(str);
|
||||
ret.data = heap_copy_c_string(str);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user