⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 long.h

📁 java 1.1 gemini 08_16
💻 H
字号:
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

/*******************************************************************************
 * Filename:
 * ---------
 *  long.h
 *
 * Project:
 * --------
 *  MAUI
 *
 * Description:
 * ------------
 *  
 *
 * Author:
 * -------
 *  
 *
 *==============================================================================
 * 				HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
 *==============================================================================
 *******************************************************************************/


/*
 * Copyright (c) 1998-2002 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * This software is the confidential and proprietary information of Sun
 * Microsystems, Inc. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Sun.
 * 
 * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
 * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
 * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
 * THIS SOFTWARE OR ITS DERIVATIVES.
 * 
 * Use is subject to license terms.
 */

/*=========================================================================
 * SYSTEM:    KVM
 * SUBSYSTEM: 64-bit arithmetic
 * FILE:      long.h
 * OVERVIEW:  Definitions needed for supporting 64-bit arithmetic
 *            in a portable fashion.
 * AUTHOR:    Frank Yellin
 *=======================================================================*/

/*=========================================================================
 * Definitions and declarations
 *=======================================================================*/

// #undef long64
// #undef ulong64

#if !COMPILER_SUPPORTS_LONG

// #if BIG_ENDIAN
// typedef struct { unsigned long high; unsigned long low; } long64;
// typedef struct { unsigned long high; unsigned long low; } ulong64;
// #else
// #undef LITTLE_ENDIAN
// #define LITTLE_ENDIAN 1
// typedef struct { unsigned long low; unsigned long high; } long64;
// typedef struct { unsigned long low; unsigned long high; } ulong64;
// #endif /* BIG_ENDIAN */

long64  ll_mul(long64, long64);
long64  ll_div(long64, long64);
long64  ll_rem(long64, long64);
long64  ll_shl(long64, int);
long64  ll_shr(long64, int);
long64  ll_ushr(long64, int);
long64  ll_add(long64, long64);
long64  ll_sub(long64, long64);

long64  float2ll(float);
long64  double2ll(double);
float   ll2float(long64);
double  ll2double(long64);

#else /* COMPILER_SUPPORTS_LONG */

#define ll_mul(a, b)    ((long64)(a) * (long64)(b))
#define ll_div(a, b)    ((long64)(a) / (long64)(b))
#define ll_rem(a,b)     ((long64)(a) % (long64)(b))
#define ll_shl(a, n)    ((long64)(a) << (n))
#define ll_shr(a, n)    ((long64)(a) >> (n))
#define ll_ushr(a, n)   ((ulong64)(a) >>(n))

#define float2ll(a)     ((long64)a)
#define double2ll(a)    ((long64)a)

#define ll2float(a)     ((float) (a))
#define ll2double(a)    ((double) (a))

#endif /* !COMPILER_SUPPORTS_LONG */

/* Here are the functions that we create the definitions for machines
 * that don't support longs.
 *
 * For all three-operand arguments, the result cannot be the same location
 * as either of the operands */

#if COMPILER_SUPPORTS_LONG

#define ll_setZero(a)        ((a) = 0)
#define ll_inc(a,b)          ((a) += (b))
#define ll_dec(a,b)          ((a) -= (b))
#define ll_negate(a)         ((a) = (-a))

/* The following weird definition fixes a bug in one particular compiler */
#define ll_uint_to_long(a,b) ((a) = (ulong64)(unsigned long)b)
#define ll_int_to_long(a,b)  ((a) = (signed long)b)
#define ll_long_to_uint(a,b) (b = (unsigned int)(a))

#define ll_compare_lt(a, b)  ((a) < (b))
#define ll_compare_eq(a, b)  ((a) == (b))
#define ll_compare_gt(a, b)  ((a) > (b))

#define ll_zero_lt(a)        (a < 0)
#define ll_zero_eq(a)        (a == 0)
#define ll_zero_gt(a)        (a > 0)

#else /* !COMPILER_SUPPORTS_LONG */

#define ll_setZero(a)        ((a).high = (a).low = 0)
#define ll_inc(a,b)          ((a).low += (b).low, \
                             (a).high += (b).high + ((a).low < (b).low));
#define ll_dec(a,b)          ((a).high -= ((b).high + ((a).low < (b).low)), \
                             (a).low  -= (b).low)
/* #define ll_negate(a)         ((a).low = -(a).low, \
                             (a).high = -((a).high + ((a).low != 0))) */
#define ll_negate(a)         ((a).low = (unsigned)(-((signed)(a).low)), \
                             (a).high = (unsigned)(-((signed)((a).high + ((a).low != 0)))))

#define ll_copy(a,b)         ((a).high = (b).high, (a).low = (b).low)

#define ll_uint_to_long(a,b) ((a).high = 0, (a).low = b)
#define ll_int_to_long(a,b)  ((a).low = b, (a).high = ((signed long)b) >> 31)
#define ll_long_to_uint(a,b) (b = (unsigned int)((a).low))

#define ll_compare_lt(a, b)  (((a).high < (b).high) || \
                             (((a).high == (b).high) && ((a).low < (b).low)))
#define ll_compare_eq(a, b)  (((a).high == (b).high) && ((a).low == (b).low))
#define ll_compare_gt(a, b)  ll_compare_lt(b, a)

/* #define ll_zero_lt(a)        ((a).high < 0) */
#define ll_zero_lt(a)        (((a).high&0x80000000)==0x80000000)
#define ll_zero_eq(a)        (((a).high | (a).low) == 0)
#define ll_zero_gt(a)        (!(ll_zero_lt(a) || ll_zero_eq(a)))

#endif /* COMPILER_SUPPORTS_LONG */

#define ll_compare_le(a,b)   (!ll_compare_gt(a,b))
#define ll_compare_ne(a,b)   (!ll_compare_eq(a,b))
#define ll_compare_ge(a,b)   (!ll_compare_lt(a,b))

#define ll_zero_le(a)        (!ll_zero_gt(a))
#define ll_zero_ne(a)        (!ll_zero_eq(a))
#define ll_zero_ge(a)        (!ll_zero_lt(a))


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -