Update to 2.0.0 tree from current Fremantle build
[opencv] / 3rdparty / include / OpenEXR / ImathPlatform.h
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
4 // Digital Ltd. LLC
5 // 
6 // All rights reserved.
7 // 
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
10 // met:
11 // *       Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 // *       Redistributions in binary form must reproduce the above
14 // copyright notice, this list of conditions and the following disclaimer
15 // in the documentation and/or other materials provided with the
16 // distribution.
17 // *       Neither the name of Industrial Light & Magic nor the names of
18 // its contributors may be used to endorse or promote products derived
19 // from this software without specific prior written permission. 
20 // 
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 //
33 ///////////////////////////////////////////////////////////////////////////
34
35
36
37 #ifndef INCLUDED_IMATHPLATFORM_H
38 #define INCLUDED_IMATHPLATFORM_H
39
40 //----------------------------------------------------------------------------
41 //
42 //      ImathPlatform.h
43 //
44 //      This file contains functions and constants which aren't 
45 //      provided by the system libraries, compilers, or includes on 
46 //      certain platforms.
47 //----------------------------------------------------------------------------
48
49 #include <math.h>
50
51 #if defined _WIN32 || defined _WIN64
52     #ifndef M_PI
53         #define M_PI 3.14159265358979323846
54     #endif
55 #endif
56
57 //-----------------------------------------------------------------------------
58 //
59 //    Fixes for the "restrict" keyword.  These #ifdef's for detecting 
60 //    compiler versions courtesy of Boost's select_compiler_config.hpp; 
61 //    here is the copyright notice for that file:
62 //
63 //    (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and
64 //    and distribute this software is granted provided this copyright notice
65 //    appears in all copies. This software is provided "as is" without express 
66 //    or implied warranty, and with no claim as to its suitability for any 
67 //    purpose.
68 //
69 //    Some compilers support "restrict", in which case we do nothing.
70 //    Other compilers support some variant of it (e.g. "__restrict").
71 //    If we don't know anything about the compiler, we define "restrict"
72 //    to be a no-op.
73 //
74 //-----------------------------------------------------------------------------
75
76 #if defined __GNUC__
77     #if !defined(restrict)
78         #define restrict __restrict
79     #endif
80
81 #elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)
82     // supports restrict, do nothing.
83
84 #elif defined __sgi
85     // supports restrict, do nothing.
86
87 #else
88     #define restrict
89
90 #endif
91
92 #endif // INCLUDED_IMATHPLATFORM_H