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