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