5947N/A/*
5947N/A * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
5947N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5947N/A *
5947N/A * This code is free software; you can redistribute it and/or modify it
5947N/A * under the terms of the GNU General Public License version 2 only, as
5947N/A * published by the Free Software Foundation. Oracle designates this
5947N/A * particular file as subject to the "Classpath" exception as provided
5947N/A * by Oracle in the LICENSE file that accompanied this code.
5947N/A *
5947N/A * This code is distributed in the hope that it will be useful, but WITHOUT
5947N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5947N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5947N/A * version 2 for more details (a copy is included in the LICENSE file that
5947N/A * accompanied this code).
5947N/A *
5947N/A * You should have received a copy of the GNU General Public License version
5947N/A * 2 along with this work; if not, write to the Free Software Foundation,
5947N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5947N/A *
5947N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5947N/A * or visit www.oracle.com if you need additional information or have any
5947N/A * questions.
5947N/A */
5947N/A
5947N/A#ifndef _WIN32_JLONG_MD_H_
5947N/A#define _WIN32_JLONG_MD_H_
5947N/A
5947N/A/* Make sure ptrdiff_t is defined */
5947N/A#include <stddef.h>
5947N/A
5947N/A#define jlong_high(a) ((jint)((a)>>32))
5947N/A#define jlong_low(a) ((jint)(a))
5947N/A#define jlong_add(a, b) ((a) + (b))
5947N/A#define jlong_and(a, b) ((a) & (b))
5947N/A#define jlong_div(a, b) ((a) / (b))
5947N/A#define jlong_mul(a, b) ((a) * (b))
5947N/A#define jlong_neg(a) (-(a))
5947N/A#define jlong_not(a) (~(a))
5947N/A#define jlong_or(a, b) ((a) | (b))
5947N/A#define jlong_shl(a, n) ((a) << (n))
5947N/A#define jlong_shr(a, n) ((a) >> (n))
5947N/A#define jlong_sub(a, b) ((a) - (b))
5947N/A#define jlong_xor(a, b) ((a) ^ (b))
5947N/A#define jlong_rem(a,b) ((a) % (b))
5947N/A
5947N/A/* comparison operators */
5947N/A#define jlong_ltz(ll) ((ll) < 0)
5947N/A#define jlong_gez(ll) ((ll) >= 0)
5947N/A#define jlong_gtz(ll) ((ll) > 0)
5947N/A#define jlong_eqz(a) ((a) == 0)
5947N/A#define jlong_eq(a, b) ((a) == (b))
5947N/A#define jlong_ne(a,b) ((a) != (b))
5947N/A#define jlong_ge(a,b) ((a) >= (b))
5947N/A#define jlong_le(a,b) ((a) <= (b))
5947N/A#define jlong_lt(a,b) ((a) < (b))
5947N/A#define jlong_gt(a,b) ((a) > (b))
5947N/A
5947N/A#define jlong_zero ((jlong) 0)
5947N/A#define jlong_one ((jlong) 1)
5947N/A#define jlong_minus_one ((jlong) -1)
5947N/A
5947N/A/* For static variables initialized to zero */
5947N/A#define jlong_zero_init ((jlong) 0)
5947N/A
5947N/A#ifdef _WIN64
5947N/A#define jlong_to_ptr(a) ((void*)(a))
#define ptr_to_jlong(a) ((jlong)(a))
#else
/* Double casting to avoid warning messages looking for casting of */
/* smaller sizes into pointers */
#define jlong_to_ptr(a) ((void*)(int)(a))
#define ptr_to_jlong(a) ((jlong)(int)(a))
#endif
#define jint_to_jlong(a) ((jlong)(a))
#define jlong_to_jint(a) ((jint)(a))
/* Useful on machines where jlong and jdouble have different endianness. */
#define jlong_to_jdouble_bits(a)
#define jdouble_to_jlong_bits(a)
#define jlong_to_int(a) ((int)(a))
#define int_to_jlong(a) ((jlong)(a))
#define jlong_to_uint(a) ((unsigned int)(a))
#define uint_to_jlong(a) ((jlong)(a))
#define jlong_to_ptrdiff(a) ((ptrdiff_t)(a))
#define ptrdiff_to_jlong(a) ((jlong)(a))
#define jlong_to_size(a) ((size_t)(a))
#define size_to_jlong(a) ((jlong)(a))
#define long_to_jlong(a) ((jlong)(a))
#endif