blob: bbc03348f2346cb4ece1f5d5eb7d973b7ba1379c [file] [log] [blame]
jat@google.com134be542009-08-03 15:30:11 +00001#ifndef _H_Platform
2#define _H_Platform
3/*
4 * Copyright 2008 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 * use this file except in compliance with the License. You may obtain a copy of
8 * the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations under
16 * the License.
17 */
18
19// Platform-specific hacks to enable more shared code elsewhere
20#ifdef _WINDOWS
21typedef __int32 int32_t;
22typedef unsigned __int32 uint32_t;
23typedef __int16 int16_t;
24typedef unsigned __int16 uint16_t;
25typedef __int64 int64_t;
26typedef unsigned __int64 uint64_t;
27typedef long ssize_t;
28
29#define snprintf sprintf_s
30#define SOCKETTYPE SOCKET
31// Bogus conversion from size_t -> unsigned int warnings.
32#pragma warning(disable:4267)
33#else
34#define SOCKETTYPE int
35#endif
36
37// Set the float byte-order if we know it -- see ByteOrder.h FloatByteOrder
38#if defined(i386) || defined(i586) || defined(i686) || defined(_x86)
39#define PLATFORM_FLOAT_ENDIANESS FLOAT_LITTLE_ENDIAN
40#endif
41
42#if defined(__sparc)
43#define PLATFORM_FLOAT_ENDIANESS FLOAT_BIG_ENDIAN
44#endif
45
46#endif