src/java.base/windows/native/libjava/jlong_md.h
author igerasim
Wed, 21 Aug 2019 13:49:16 -0700
changeset 57826 bf4c808a4488
parent 47216 71c04702a3d5
permissions -rw-r--r--
8211360: Change #if DEF to #if defined(DEF) Reviewed-by: bpb, vtewari
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#ifndef _WIN32_JLONG_MD_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define _WIN32_JLONG_MD_H_
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/* Make sure ptrdiff_t is defined */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include <stddef.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#define jlong_high(a)   ((jint)((a)>>32))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#define jlong_low(a)    ((jint)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#define jlong_add(a, b) ((a) + (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#define jlong_and(a, b) ((a) & (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#define jlong_div(a, b) ((a) / (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#define jlong_mul(a, b) ((a) * (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#define jlong_neg(a)    (-(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#define jlong_not(a)    (~(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#define jlong_or(a, b)  ((a) | (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define jlong_shl(a, n) ((a) << (n))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define jlong_shr(a, n) ((a) >> (n))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define jlong_sub(a, b) ((a) - (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#define jlong_xor(a, b) ((a) ^ (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define jlong_rem(a,b)  ((a) % (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
/* comparison operators */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define jlong_ltz(ll)   ((ll) < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define jlong_gez(ll)   ((ll) >= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#define jlong_gtz(ll)   ((ll) > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define jlong_eqz(a)    ((a) == 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#define jlong_eq(a, b)  ((a) == (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#define jlong_ne(a,b)   ((a) != (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
#define jlong_ge(a,b)   ((a) >= (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
#define jlong_le(a,b)   ((a) <= (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#define jlong_lt(a,b)   ((a) < (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
#define jlong_gt(a,b)   ((a) > (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
#define jlong_zero      ((jlong) 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#define jlong_one       ((jlong) 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#define jlong_minus_one ((jlong) -1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
/* For static variables initialized to zero */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#define jlong_zero_init ((jlong) 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#ifdef _WIN64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define jlong_to_ptr(a) ((void*)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
#define ptr_to_jlong(a) ((jlong)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
/* Double casting to avoid warning messages looking for casting of */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
/* smaller sizes into pointers */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define jlong_to_ptr(a) ((void*)(int)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define ptr_to_jlong(a) ((jlong)(int)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
#define jint_to_jlong(a)        ((jlong)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
#define jlong_to_jint(a)        ((jint)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
/* Useful on machines where jlong and jdouble have different endianness. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
#define jlong_to_jdouble_bits(a)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
#define jdouble_to_jlong_bits(a)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
#define jlong_to_int(a)     ((int)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
#define int_to_jlong(a)     ((jlong)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
#define jlong_to_uint(a)    ((unsigned int)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
#define uint_to_jlong(a)    ((jlong)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
#define jlong_to_ptrdiff(a) ((ptrdiff_t)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
#define ptrdiff_to_jlong(a) ((jlong)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
#define jlong_to_size(a)    ((size_t)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
#define size_to_jlong(a)    ((jlong)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
#define long_to_jlong(a)    ((jlong)(a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
#endif