darin | c63e194 | 2006-04-06 06:07:42 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2005, 2006 Apple Computer, Inc. |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public License |
| 15 | * along with this library; see the file COPYING.LIB. If not, write to |
| 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
| 18 | * |
| 19 | */ |
| 20 | |
darin | f12397f | 2005-09-24 03:28:28 +0000 | [diff] [blame] | 21 | #ifndef STDINT_WIN32_H |
| 22 | #define STDINT_WIN32_H |
| 23 | |
kmccullo | d129ead | 2006-10-04 18:36:29 +0000 | [diff] [blame] | 24 | #include <wtf/Platform.h> |
| 25 | |
darin | c63e194 | 2006-04-06 06:07:42 +0000 | [diff] [blame] | 26 | /* This file emulates enough of stdint.h on Windows to make JavaScriptCore and WebCore compile. */ |
kmccullo | d129ead | 2006-10-04 18:36:29 +0000 | [diff] [blame] | 27 | |
mjs | 3bfb61b | 2006-03-02 09:12:06 +0000 | [diff] [blame] | 28 | #if !PLATFORM(WIN_OS) |
darin | f12397f | 2005-09-24 03:28:28 +0000 | [diff] [blame] | 29 | #error "This stdint.h file should only be compiled under Windows" |
| 30 | #endif |
darin | c63e194 | 2006-04-06 06:07:42 +0000 | [diff] [blame] | 31 | |
jchaffraix@webkit.org | 3e08861 | 2008-05-07 17:16:03 +0000 | [diff] [blame] | 32 | #include <limits.h> |
| 33 | |
darin | c63e194 | 2006-04-06 06:07:42 +0000 | [diff] [blame] | 34 | typedef unsigned char uint8_t; |
| 35 | typedef signed char int8_t; |
darin | f12397f | 2005-09-24 03:28:28 +0000 | [diff] [blame] | 36 | typedef unsigned short uint16_t; |
| 37 | typedef short int16_t; |
| 38 | typedef unsigned int uint32_t; |
| 39 | typedef int int32_t; |
darin | c63e194 | 2006-04-06 06:07:42 +0000 | [diff] [blame] | 40 | typedef __int64 int64_t; |
darin | f12397f | 2005-09-24 03:28:28 +0000 | [diff] [blame] | 41 | typedef unsigned __int64 uint64_t; |
| 42 | |
jchaffraix@webkit.org | 3e08861 | 2008-05-07 17:16:03 +0000 | [diff] [blame] | 43 | #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) |
| 44 | #ifndef SIZE_MAX |
| 45 | #ifdef _WIN64 |
| 46 | #define SIZE_MAX _UI64_MAX |
| 47 | #else |
| 48 | #define SIZE_MAX _UI32_MAX |
| 49 | #endif |
| 50 | #endif |
| 51 | #endif |
| 52 | |
darin | f12397f | 2005-09-24 03:28:28 +0000 | [diff] [blame] | 53 | #ifndef CASSERT |
darin | c63e194 | 2006-04-06 06:07:42 +0000 | [diff] [blame] | 54 | #define CASSERT(exp, name) typedef int dummy##name [(exp) ? 1 : -1]; |
darin | f12397f | 2005-09-24 03:28:28 +0000 | [diff] [blame] | 55 | #endif |
| 56 | |
darin | c63e194 | 2006-04-06 06:07:42 +0000 | [diff] [blame] | 57 | CASSERT(sizeof(int8_t) == 1, int8_t_is_one_byte) |
| 58 | CASSERT(sizeof(uint8_t) == 1, uint8_t_is_one_byte) |
| 59 | CASSERT(sizeof(int16_t) == 2, int16_t_is_two_bytes) |
| 60 | CASSERT(sizeof(uint16_t) == 2, uint16_t_is_two_bytes) |
| 61 | CASSERT(sizeof(int32_t) == 4, int32_t_is_four_bytes) |
| 62 | CASSERT(sizeof(uint32_t) == 4, uint32_t_is_four_bytes) |
| 63 | CASSERT(sizeof(int64_t) == 8, int64_t_is_four_bytes) |
| 64 | CASSERT(sizeof(uint64_t) == 8, uint64_t_is_four_bytes) |
darin | f12397f | 2005-09-24 03:28:28 +0000 | [diff] [blame] | 65 | |
| 66 | #endif |