Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/native/common/jlong_md.h
32285 views
/*1* Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef _SOLARIS_JLONG_MD_H_26#define _SOLARIS_JLONG_MD_H_2728/* Make sure ptrdiff_t is defined */29#include <stddef.h>30#include <stdint.h> /* For uintptr_t */3132#define jlong_high(a) ((jint)((a)>>32))33#define jlong_low(a) ((jint)(a))34#define jlong_add(a, b) ((a) + (b))35#define jlong_and(a, b) ((a) & (b))36#define jlong_div(a, b) ((a) / (b))37#define jlong_mul(a, b) ((a) * (b))38#define jlong_neg(a) (-(a))39#define jlong_not(a) (~(a))40#define jlong_or(a, b) ((a) | (b))41#define jlong_shl(a, n) ((a) << (n))42#define jlong_shr(a, n) ((a) >> (n))43#define jlong_sub(a, b) ((a) - (b))44#define jlong_xor(a, b) ((a) ^ (b))45#define jlong_rem(a,b) ((a) % (b))4647/* comparison operators */48#define jlong_ltz(ll) ((ll)<0)49#define jlong_gez(ll) ((ll)>=0)50#define jlong_gtz(ll) ((ll)>0)51#define jlong_eqz(a) ((a) == 0)52#define jlong_eq(a, b) ((a) == (b))53#define jlong_ne(a,b) ((a) != (b))54#define jlong_ge(a,b) ((a) >= (b))55#define jlong_le(a,b) ((a) <= (b))56#define jlong_lt(a,b) ((a) < (b))57#define jlong_gt(a,b) ((a) > (b))5859#define jlong_zero ((jlong) 0)60#define jlong_one ((jlong) 1)61#define jlong_minus_one ((jlong) -1)6263/* For static variables initialized to zero */64#define jlong_zero_init ((jlong) 0L)6566#ifdef _LP6467#define jlong_to_ptr(a) ((void*)(a))68#define ptr_to_jlong(a) ((jlong)(a))69#else70#define jlong_to_ptr(a) ((void*)(int)(a))71#define ptr_to_jlong(a) ((jlong)(int)(a))72#endif7374#define jint_to_jlong(a) ((jlong)(a))75#define jlong_to_jint(a) ((jint)(a))7677/* Useful on machines where jlong and jdouble have different endianness. */78#define jlong_to_jdouble_bits(a)79#define jdouble_to_jlong_bits(a)8081#define jlong_to_int(a) ((int)(a))82#define int_to_jlong(a) ((jlong)(a))83#define jlong_to_uint(a) ((unsigned int)(a))84#define uint_to_jlong(a) ((jlong)(a))85#define jlong_to_ptrdiff(a) ((ptrdiff_t)(a))86#define ptrdiff_to_jlong(a) ((jlong)(a))87#define jlong_to_size(a) ((size_t)(a))88#define size_to_jlong(a) ((jlong)(a))89#define long_to_jlong(a) ((jlong)(a))9091#endif /* !_SOLARIS_JLONG_MD_H_ */929394