home *** CD-ROM | disk | FTP | other *** search
/ Java Programmer's Toolkit / Java Programmer's Toolkit.iso / solaris2 / jdk / include / solaris / typedefs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-30  |  2.5 KB  |  88 lines

  1. /*
  2.  * @(#)typedefs_md.h    1.20 95/10/16
  3.  *
  4.  * Copyright (c) 1994 Sun Microsystems, Inc. All Rights Reserved.
  5.  *
  6.  * Permission to use, copy, modify, and distribute this software
  7.  * and its documentation for NON-COMMERCIAL purposes and without
  8.  * fee is hereby granted provided that this copyright notice
  9.  * appears in all copies. Please refer to the file "copyright.html"
  10.  * for further important copyright and licensing information.
  11.  *
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  13.  * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  14.  * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  15.  * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
  16.  * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  17.  * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  18.  */
  19.  
  20. /*
  21.  * Solaris-dependent types for Green threads
  22.  */
  23.  
  24. #ifndef _SOLARIS_TYPES_MD_H_
  25. #define _SOLARIS_TYPES_MD_H_
  26.  
  27. #include <sys/types.h>
  28. #include <bool.h>
  29.  
  30. #ifndef    _UINT64_T
  31. #define    _UINT64_T
  32. typedef unsigned long long uint64_t;
  33. #define _UINT32_T
  34. typedef unsigned long uint32_t;
  35. #endif
  36.  
  37. #ifndef    _INT64_T
  38. #define    _INT64_T
  39. typedef long long int64_t;
  40. #define _INT32_T
  41. typedef long int32_t;
  42. #endif
  43.  
  44.  
  45. /* use these macros when the compiler supports the long long type */
  46.  
  47. #define ll_high(a)    ((long)((a)>>32))
  48. #define ll_low(a)    ((long)(a))
  49. #define int2ll(a)    ((int64_t)(a))
  50. #define ll2int(a)    ((int)(a))
  51. #define ll_add(a, b)    ((a) + (b))
  52. #define ll_and(a, b)    ((a) & (b))
  53. #define ll_div(a, b)    ((a) / (b))
  54. #define ll_mul(a, b)    ((a) * (b))
  55. #define ll_neg(a)    (-(a))
  56. #define ll_not(a)    (~(a))
  57. #define ll_or(a, b)    ((a) | (b))
  58. #define ll_shl(a, n)    ((a) << (n))
  59. #define ll_shr(a, n)    ((a) >> (n))
  60. #define ll_sub(a, b)    ((a) - (b))
  61. #define ll_ushr(a, n)    ((unsigned long long)(a) >> (n))
  62. #define ll_xor(a, b)    ((a) ^ (b))
  63. #define uint2ll(a)    ((uint64_t)(unsigned long)(a))
  64. #define ll_rem(a,b)    ((a) % (b))
  65.  
  66. #define float2ll(f)    ((int64_t) (f))
  67. #define ll2float(a)    ((float) (a))
  68. #define ll2double(a)    ((double) (a))
  69. #define double2ll(f)    ((int64_t) (f))
  70.  
  71. /* comparison operators */
  72. #define ll_ltz(ll)    ((ll)<0)
  73. #define ll_gez(ll)    ((ll)>=0)
  74. #define ll_eqz(a)    ((a) == 0)
  75. #define ll_eq(a, b)    ((a) == (b))
  76. #define ll_ne(a,b)    ((a) != (b))
  77. #define ll_ge(a,b)    ((a) >= (b))
  78. #define ll_le(a,b)    ((a) <= (b))
  79. #define ll_lt(a,b)    ((a) < (b))
  80. #define ll_gt(a,b)    ((a) > (b))
  81.  
  82. #define ll_zero_const    ((int64_t) 0)
  83. #define ll_one_const    ((int64_t) 1)
  84.  
  85. extern void ll2str(int64_t a, char *s, char *limit);
  86.  
  87. #endif /* !_SOLARIS_TYPES_MD_H_ */
  88.