Darwin  1.10(beta)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
drwnCompatibility.h
Go to the documentation of this file.
1 /*****************************************************************************
2 ** DARWIN: A FRAMEWORK FOR MACHINE LEARNING RESEARCH AND DEVELOPMENT
3 ** Distributed under the terms of the BSD license (see the LICENSE file)
4 ** Copyright (c) 2007-2015, Stephen Gould
5 ** All rights reserved.
6 **
7 ******************************************************************************
8 ** FILENAME: drwnCompatibility.h
9 ** AUTHOR(S): Stephen Gould <stephen.gould@anu.edu.au>
10 **
11 *****************************************************************************/
12 
19 #pragma once
20 
21 // Microsoft Visual Studio (Win32)
22 #if defined(_WIN32)||defined(WIN32)||defined(__WIN32__)||defined(__VISUALC__)
23 #pragma warning(disable: 4018) // signed/unsigned mismatch
24 #pragma warning(disable: 4267) // conversion from size_t to int
25 #pragma warning(disable: 4244) // conversion from double to float
26 #pragma warning(disable: 4355) // this used in base member constructor
27 #pragma warning(disable: 4996) // unsafe functions
28 #define __PRETTY_FUNCTION__ __FUNCTION__
29 #ifndef _CRT_SECURE_NO_DEPRECATE
30 #define _CRT_SECURE_NO_DEPRECATE 1
31 #endif
32 #define _USE_MATH_DEFINES
33 #ifndef NOMINMAX
34 #define NOMINMAX
35 #endif
36 #undef min
37 #undef max
38 #define strcasecmp _stricmp
39 typedef __int32 int32_t;
40 typedef unsigned __int32 uint32_t;
41 #ifndef isnan
42 #define isnan(x) (_isnan(x))
43 #endif
44 #ifndef isinf
45 #define isinf(x) (!_finite(x))
46 #endif
47 #ifndef isfinite
48 #define isfinite(x) (_finite(x))
49 #endif
50 #define drand48() ((double) rand() / (double)(RAND_MAX + 1))
51 #define srand48(seed) (srand(seed))
52 #define round(x) (((x) < 0) ? ceil((x)-0.5) : floor((x)+0.5))
53 #define DRWN_DIRSEP '\\'
54 #endif
55 
56 // Linux
57 #if defined(__LINUX__)
58 #define DRWN_DIRSEP '/'
59 #endif
60 
61 // Mac OS X
62 #if defined(__APPLE__)
63 #define DRWN_DIRSEP '/'
64 #endif