blob: 7c41e9aa706a489603c163df2e005a1b10621a0f [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1994-2002 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26/*
27 * Win32 dependent type definitions
28 */
29
30#ifndef _JAVASOFT_WIN32_TYPEDEF_MD_H_
31#define _JAVASOFT_WIN32_TYPEDEF_MD_H_
32
33#include <windows.h>
34
35#define VARGS(x) (&x)
36
37typedef char int8_t;
38typedef __int16 int16_t;
39typedef __int32 int32_t;
40typedef __int64 int64_t;
41
42typedef unsigned char uint8_t;
43typedef unsigned __int16 uint16_t;
44typedef unsigned int uint_t;
45typedef unsigned __int32 uint32_t;
46typedef unsigned __int64 uint64_t;
47
48/* Make sure that we have the intptr_t and uintptr_t definitions */
49#ifndef _INTPTR_T_DEFINED
50#ifdef _WIN64
51typedef __int64 intptr_t;
52#else
53typedef int intptr_t;
54#endif
55#define _INTPTR_T_DEFINED
56#endif
57
58#ifndef _UINTPTR_T_DEFINED
59#ifdef _WIN64
60typedef unsigned __int64 uintptr_t;
61#else
62typedef unsigned int uintptr_t;
63#endif
64#define _UINTPTR_T_DEFINED
65#endif
66
67typedef intptr_t ssize_t;
68
69/* use these macros when the compiler supports the long long type */
70
71#define ll_high(a) ((long)((a)>>32))
72#define ll_low(a) ((long)(a))
73#define int2ll(a) ((int64_t)(a))
74#define ll2int(a) ((int)(a))
75#define ll_add(a, b) ((a) + (b))
76#define ll_and(a, b) ((a) & (b))
77#define ll_div(a, b) ((a) / (b))
78#define ll_mul(a, b) ((a) * (b))
79#define ll_neg(a) (-(a))
80#define ll_not(a) (~(a))
81#define ll_or(a, b) ((a) | (b))
82/* THE FOLLOWING DEFINITION IS NOW A FUNCTION CALL IN ORDER TO WORKAROUND
83 OPTIMIZER BUG IN MSVC++ 2.1 (see system_md.c)
84 #define ll_shl(a, n) ((a) << (n)) */
85#define ll_shr(a, n) ((a) >> (n))
86#define ll_sub(a, b) ((a) - (b))
87#define ll_ushr(a, n) ((uint64_t)(a) >> (n))
88#define ll_xor(a, b) ((a) ^ (b))
89#define uint2ll(a) ((uint64_t)(unsigned long)(a))
90#define ll_rem(a,b) ((a) % (b))
91
92int32_t float2l(float f);
93int32_t double2l(double f);
94int64_t float2ll(float f);
95int64_t double2ll(double f);
96#define ll2float(a) ((float) (a))
97#define ll2double(a) ((double) (a))
98
99/* Useful on machines where jlong and jdouble have different endianness. */
100#define ll2double_bits(a) ((void) 0)
101
102/* comparison operators */
103#define ll_ltz(ll) ((ll) < 0)
104#define ll_gez(ll) ((ll) >= 0)
105#define ll_eqz(a) ((a) == 0)
106#define ll_nez(a) ((a) != 0)
107#define ll_eq(a, b) ((a) == (b))
108#define ll_ne(a,b) ((a) != (b))
109#define ll_ge(a,b) ((a) >= (b))
110#define ll_le(a,b) ((a) <= (b))
111#define ll_lt(a,b) ((a) < (b))
112#define ll_gt(a,b) ((a) > (b))
113
114#define ll_zero_const ((int64_t) 0)
115#define ll_one_const ((int64_t) 1)
116
117int64_t ll_shl(int64_t a, int bits);
118
119#define ll2ptr(a) ((void*)(a))
120#define ptr2ll(a) ((jlong)(a))
121
122/* printf format modifier for printing pointers */
123#define FORMAT64_MODIFIER "I64"
124
125#endif /* !_JAVASOFT_WIN32_TYPEDEF_MD_H_ */