1 // Copyright 2005-2019 The Mumble Developers. All rights reserved.
2 // Use of this source code is governed by a BSD-style license
3 // that can be found in the LICENSE file at the root of the
4 // Mumble source tree or at <https://www.mumble.info/LICENSE>.
5 
6 // This header file defines common utility macros and values that are generally valid or used across multiple areas giving them generic scope (rather than localized or functionality-specific scope).
7 
8 #ifndef MUMBLE_UTILS_H_
9 #define MUMBLE_UTILS_H_
10 
11 #include "QAtomicIntCompat.h"
12 
13 #if QT_VERSION >= 0x050000
14 	#include "Qt4Compat.h"
15 #endif
16 
17 #include <QtCore/QtGlobal>
18 
19 #define iroundf(x) ( static_cast<int>(x) )
20 
21 #ifdef Q_OS_WIN
22 # define STACKVAR(type, varname, count) type *varname=reinterpret_cast<type *>(_alloca(sizeof(type) * (count)))
23 #else
24 # ifdef WId
25    typedef WId HWND;
26 # endif
27 # define __cdecl
28 # define INVALID_SOCKET -1
29 # define SOCKET_ERROR -1
30 # define STACKVAR(type, varname, count) type varname[count]
31 # define CopyMemory(dst,ptr,len) memcpy(dst,ptr,len)
32 # define ZeroMemory(ptr,len) memset(ptr, 0, len)
33 #endif
34 
35 #endif // MUMBLE_UTILS_H_
36