Gosu
Gosu
Platform.hpp
Go to the documentation of this file.
1
4
#pragma once
5
6
#ifdef __BIG_ENDIAN__
7
# define GOSU_IS_BIG_ENDIAN
8
# define IDENTITY_FUN big_to_native
9
# define IDENTITY_FUN2 native_to_big
10
# define CONV_FUN little_to_native
11
# define CONV_FUN2 native_to_little
12
#else
13
# define GOSU_IS_LITTLE_ENDIAN
14
# define IDENTITY_FUN little_to_native
15
# define IDENTITY_FUN2 native_to_little
16
# define CONV_FUN big_to_native
17
# define CONV_FUN2 native_to_big
18
#endif
19
20
#include <algorithm>
21
22
namespace
Gosu
23
{
24
template
<
typename
T> T IDENTITY_FUN(T t) {
return
t; }
25
template
<
typename
T> T IDENTITY_FUN2(T t) {
return
t; }
26
27
template
<
typename
T>
28
T CONV_FUN(T t)
29
{
30
char
* begin =
reinterpret_cast<
char
*
>
(&t);
31
std::reverse(begin, begin +
sizeof
t);
32
return
t;
33
}
34
35
template
<
typename
T> T CONV_FUN2(T t) {
return
CONV_FUN(t); }
36
}
37
38
#undef IDENTITY_FUN
39
#undef IDENTITY_FUN2
40
#undef CONV_FUN
41
#undef CONV_FUN2
42
43
#if defined(_MSC_VER)
44
# define GOSU_NORETURN __declspec(noreturn)
45
#elif defined(__GNUC__)
46
# define GOSU_NORETURN __attribute__ ((noreturn))
47
#endif
48
49
#if defined(WIN32) || defined(_WIN64)
50
# define GOSU_IS_WIN
51
#else
52
# define GOSU_IS_UNIX
53
# if defined(__linux) || defined(__FreeBSD__)
54
# define GOSU_IS_X
55
# else
56
# define GOSU_IS_MAC
57
# include <TargetConditionals.h>
58
# if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
59
# define GOSU_IS_IPHONE
60
# define GOSU_IS_OPENGLES
61
# endif
62
# endif
63
#endif
64
65
#ifndef GOSU_DEPRECATED
66
# if defined(GOSU_IS_WIN)
67
# define GOSU_DEPRECATED __declspec(deprecated)
68
# else
69
# define GOSU_DEPRECATED __attribute__((__deprecated__))
70
# endif
71
#endif
Gosu
Definition:
Audio.hpp:12
Generated by
1.8.13