home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / typedefs_md.h < prev    next >
C/C++ Source or Header  |  1997-11-24  |  3KB  |  98 lines

  1. /*
  2.  * @(#)typedefs_md.h    1.24 97/06/25
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  * 
  21.  */
  22.  
  23. /*
  24.  * Win32 dependent type definitions
  25.  */
  26.  
  27. #ifndef _WIN32_TYPEDEF_MD_H_
  28. #define _WIN32_TYPEDEF_MD_H_
  29.  
  30. #include <windows.h>
  31.  
  32. #include "bool.h"
  33.  
  34. typedef unsigned int uint_t;
  35. typedef long int32_t;
  36. typedef unsigned long uint32_t;
  37. typedef __int64    int64_t;
  38. typedef unsigned __int64 uint64_t;
  39.  
  40. /* use these macros when the compiler supports the long long type */
  41.  
  42. #define ll_high(a)    ((long)((a)>>32))
  43. #define ll_low(a)    ((long)(a))
  44. #define int2ll(a)    ((int64_t)(a))
  45. #define ll2int(a)    ((int)(a))
  46. #define ll_add(a, b)    ((a) + (b))
  47. #define ll_and(a, b)    ((a) & (b))
  48. #define ll_div(a, b)    ((a) / (b))
  49. #define ll_mul(a, b)    ((a) * (b))
  50. #define ll_neg(a)    (-(a))
  51. #define ll_not(a)    (~(a))
  52. #define ll_or(a, b)    ((a) | (b))
  53. /* THE FOLLOWING DEFINITION IS NOW A FUNCTION CALL IN ORDER TO WORKAROUND
  54.    OPTIMIZER BUG IN MSVC++ 2.1 (see system_md.c)
  55.    #define ll_shl(a, n)    ((a) << (n)) */
  56. #define ll_shr(a, n)    ((a) >> (n))
  57. #define ll_sub(a, b)    ((a) - (b))
  58. #define ll_ushr(a, n)    ((uint64_t)(a) >> (n))
  59. #define ll_xor(a, b)    ((a) ^ (b))
  60. #define uint2ll(a)    ((uint64_t)(unsigned long)(a))
  61. #define ll_rem(a,b)    ((a) % (b))
  62.  
  63. #define INT_OP(x,op,y)  (((#@op=='/')||(#@op=='%')) ?                  \
  64.              ( (((x)==0x80000000)&&((y)==-1)) ?            \
  65.                  ((x) op 1) :                              \
  66.                  ((x) op (y))) :                           \
  67.              ((x) op (y)))
  68. #define NAN_CHECK(l,r,x) (!_isnan((l))&&!_isnan((r))) ? (x : 0)
  69. #define IS_NAN(x) _isnan(x)
  70.  
  71. int32_t float2l(float f);
  72. int32_t double2l(double f);
  73. int64_t float2ll(float f);
  74. int64_t double2ll(double f);
  75. #define ll2float(a)    ((float) (a))
  76. #define ll2double(a)    ((double) (a))
  77.  
  78. /* comparison operators */
  79. #define ll_ltz(ll)    ((ll) < 0)
  80. #define ll_gez(ll)    ((ll) >= 0)
  81. #define ll_eqz(a)    ((a) == 0)
  82. #define ll_eq(a, b)    ((a) == (b))
  83. #define ll_ne(a,b)    ((a) != (b))
  84. #define ll_ge(a,b)    ((a) >= (b))
  85. #define ll_le(a,b)    ((a) <= (b))
  86. #define ll_lt(a,b)    ((a) < (b))
  87. #define ll_gt(a,b)    ((a) > (b))
  88.  
  89. #define ll_zero_const    ((int64_t) 0)
  90. #define ll_one_const    ((int64_t) 1)
  91.  
  92. extern void ll2str(int64_t a, char *s, char *limit);
  93. extern int64_t ll_shl(int64_t a, int bits);
  94.  
  95. #include <stdlib.h>    /* For malloc() and free() */
  96.  
  97. #endif /* !_WIN32_TYPEDEF_MD_H_ */
  98.