blob: c94062a4bd15205979432f13f4bce8b00a7d303c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
extern "C" {
#include "libc.h"
}
#ifdef __MINGW32__
#include <_mingw.h>
#endif
template <uint32_t Major, uint32_t Minor>
class version_t {
constexpr static auto buflen() noexcept {
unsigned int len = 2; // "."
if (Major == 0) {
len++;
} else {
for (auto n = Major; n; len++, n /= 10);
}
if (Minor == 0) {
len++;
} else {
for (auto n = Minor; n; len++, n /= 10);
}
return len;
}
char buf[buflen()] = {};
public:
constexpr version_t() noexcept {
auto ptr = buf + buflen();
*--ptr = '\0';
if (Minor == 0) {
*--ptr = '0';
} else {
for (auto n = Minor; n; n /= 10) {
*--ptr = "0123456789"[n % 10];
}
}
*--ptr = '.';
if (Major == 0) {
*--ptr = '0';
} else {
for (auto n = Major; n; n /= 10) {
*--ptr = "0123456789"[n % 10];
}
}
}
constexpr operator const char*() const {
return buf;
}
};
template <uint32_t Major, uint32_t Minor>
constexpr version_t<Major, Minor> version;
extern "C" const char* ffDetectLibc(FFLibcResult* result) {
#ifdef _UCRT
result->name = "ucrt";
#else
result->name = "msvcrt";
#endif
result->version = version<(__MSVCRT_VERSION__ >> 8), (__MSVCRT_VERSION__ & 8)>;
return NULL;
}
|