1
2/* Copyright (C) 1999-2019 by The D Language Foundation, All Rights Reserved
3 * http://www.digitalmars.com
4 * Distributed under the Boost Software License, Version 1.0.
5 * http://www.boost.org/LICENSE_1_0.txt
6 * https://github.com/dlang/dmd/blob/master/src/dmd/root/port.h
7 */
8
9#pragma once
10
11// Portable wrapper around compiler/system specific things.
12// The idea is to minimize #ifdef's in the app code.
13
14#include "dsystem.h" // for alloca
15
16#if _MSC_VER
17typedef __int64 longlong;
18typedef unsigned __int64 ulonglong;
19#else
20typedef long long longlong;
21typedef unsigned long long ulonglong;
22#endif
23
24typedef unsigned char utf8_t;
25
26struct Port
27{
28    static int memicmp(const char *s1, const char *s2, size_t n);
29    static char *strupr(char *s);
30
31    static bool isFloat32LiteralOutOfRange(const char *s);
32    static bool isFloat64LiteralOutOfRange(const char *s);
33
34    static void writelongLE(unsigned value, void *buffer);
35    static unsigned readlongLE(void *buffer);
36    static void writelongBE(unsigned value, void *buffer);
37    static unsigned readlongBE(void *buffer);
38    static unsigned readwordLE(void *buffer);
39    static unsigned readwordBE(void *buffer);
40    static void valcpy(void *dst, uint64_t val, size_t size);
41};
42