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

📄 typedefs.h

📁 《移动Agent技术》一书的所有章节源代码。
💻 H
字号:
/*
 * @(#)typedefs.h       1.15 96/12/22
 *
 * Copyright (c) 1995, 1996 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.
 *
 * CopyrightVersion 1.1_beta
 *
 */

#ifndef _TYPEDEFS_H_
#define _TYPEDEFS_H_

#include "typedefs_md.h"        /* for int64_t */

/*
 * Macros to deal with the JavaVM's stack alignment. Many machines
 * require doublewords to be double aligned.  This union is used by
 * code in math.h as a more portable way do alingnment on machines
 * that require it.  This union and the macros that use it came from
 * Netscape.
 */

typedef union Java8Str {
    int32_t x[2];
    double_t d;                                                 /*ibm.1229*/
    int64_t l;
    void *p;
} Java8;


#ifdef HAVE_ALIGNED_LONGLONGS
#define GET_INT64(_t,_addr) ( ((_t).x[0] = ((int32_t*)(_addr))[0]), \
                              ((_t).x[1] = ((int32_t*)(_addr))[1]), \
                              (_t).l )
#define SET_INT64(_t, _addr, _v) ( (_t).l = (_v),                    \
                                   ((int32_t*)(_addr))[0] = (_t).x[0], \
                                   ((int32_t*)(_addr))[1] = (_t).x[1] )
#if defined(IBM_MIXED_MODE)                                         /*ibm.6205*/
#define SET_INT64_REVERSE(_t, _addr, _v) ( (_t).l = (_v),               \
                                   ((int32_t*)(_addr))[0] = (_t).x[1],  \
                                   ((int32_t*)(_addr))[1] = (_t).x[0] )
#endif /* +IBM_MIXED_MODE */                                        /*ibm.6205*/
#else
#define GET_INT64(_t,_addr) (*(int64_t*)(_addr))
#define SET_INT64(_t, _addr, _v) (*(int64_t*)(_addr) = (_v))
#if defined(IBM_MIXED_MODE)                                         /*ibm.6205*/
#define SET_INT64_REVERSE(_t, _addr, _v) ( (_t).l = (_v),               \
                                   ((int32_t*)(_addr))[0] = (_t).x[1],  \
                                   ((int32_t*)(_addr))[1] = (_t).x[0] )
#endif /* +IBM_MIXED_MODE */                                        /*ibm.6205*/
#endif

/* If double's must be aligned on doubleword boundaries then define this */
#ifdef HAVE_ALIGNED_DOUBLES
#define GET_DOUBLE(_t,_addr) ( ((_t).x[0] = ((int32_t*)(_addr))[0]), \
                               ((_t).x[1] = ((int32_t*)(_addr))[1]), \
                               (_t).d )
#define SET_DOUBLE(_t, _addr, _v) ( (_t).d = (_v),                    \
                                    ((int32_t*)(_addr))[0] = (_t).x[0], \
                                    ((int32_t*)(_addr))[1] = (_t).x[1] )
#if defined(IBM_MIXED_MODE)                                         /*ibm.6205*/
#define SET_DOUBLE_REVERSE(_t, _addr, _v) ( (_t).d = (_v),              \
                                    ((int32_t*)(_addr))[0] = (_t).x[1], \
                                    ((int32_t*)(_addr))[1] = (_t).x[0] )
#endif /* +IBM_MIXED_MODE */                                        /*ibm.6205*/
#else
#define GET_DOUBLE(_t,_addr) (*(double_t*)(_addr))                      /*ibm.1229*/
#define SET_DOUBLE(_t, _addr, _v) (*(double_t*)(_addr) = (_v))          /*ibm.1229*/
#if defined(IBM_MIXED_MODE)                                         /*ibm.6205*/
#define SET_DOUBLE_REVERSE(_t, _addr, _v) ( (_t).d = (_v),              \
                                    ((int32_t*)(_addr))[0] = (_t).x[1], \
                                    ((int32_t*)(_addr))[1] = (_t).x[0] )
#endif /* +IBM_MIXED_MODE */                                        /*ibm.6205*/
#endif

/* If pointers are 64bits then define this */
#ifdef HAVE_64BIT_POINTERS
#define GET_HANDLE(_t,_addr) ( ((_t).x[0] = ((int32_t*)(_addr))[0]), \
                               ((_t).x[1] = ((int32_t*)(_addr))[1]), \
                               (_t).p )
#define SET_HANDLE(_t, _addr, _v) ( (_t).p = (_v),                    \
                                    ((int32_t*)(_addr))[0] = (_t).x[0], \
                                    ((int32_t*)(_addr))[1] = (_t).x[1] )
#else
#define GET_HANDLE(_t,_addr) (*(JHandle*)(_addr))
#define SET_HANDLE(_t, _addr, _v) (*(JHandle*)(_addr) = (_v))
#endif


#endif  /* !_TYPEDEFS_H_ */

⌨️ 快捷键说明

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