/* -----------------------------------------------------------------------------
- * $Id: PrimOps.h,v 1.49 2000/04/05 14:26:31 panne Exp $
+ * $Id: PrimOps.h,v 1.54 2000/05/12 20:01:28 panne Exp $
*
* (c) The GHC Team, 1998-1999
*
#ifdef SUPPORT_LONG_LONGS
-#define integerToWord64zh(r, sa,da) \
-{ unsigned long int* d; \
- I_ aa; \
- StgWord64 res; \
- \
- d = (unsigned long int *) (BYTE_ARR_CTS(da)); \
- aa = ((StgArrWords *)da)->words; \
- if ( (aa) == 0 ) { \
- res = (LW_)0; \
- } else if ( (aa) == 1) { \
- res = (LW_)d[0]; \
- } else { \
- res = (LW_)d[0] + (LW_)d[1] * 0x100000000ULL; \
- } \
- (r) = res; \
+#define integerToWord64zh(r, sa,da) \
+{ unsigned long int* d; \
+ I_ s; \
+ StgWord64 res; \
+ \
+ d = (unsigned long int *) (BYTE_ARR_CTS(da)); \
+ s = (sa); \
+ if ( s == 0 ) { \
+ res = (LW_)0; \
+ } else if ( s == 1) { \
+ res = (LW_)d[0]; \
+ } else { \
+ res = (LW_)d[0] + (LW_)d[1] * 0x100000000ULL; \
+ } \
+ (r) = res; \
}
-#define integerToInt64zh(r, sa,da) \
-{ unsigned long int* d; \
- I_ aa; \
- StgInt64 res; \
- \
- d = (unsigned long int *) (BYTE_ARR_CTS(da)); \
- aa = ((StgArrWords *)da)->words; \
- if ( (aa) == 0 ) { \
- res = (LI_)0; \
- } else if ( (aa) == 1) { \
- res = (LI_)d[0]; \
- } else { \
- res = (LI_)d[0] + (LI_)d[1] * 0x100000000LL; \
- if ( sa < 0 ) { \
- res = (LI_)-res; \
- } \
- } \
- (r) = res; \
+#define integerToInt64zh(r, sa,da) \
+{ unsigned long int* d; \
+ I_ s; \
+ StgInt64 res; \
+ \
+ d = (unsigned long int *) (BYTE_ARR_CTS(da)); \
+ s = (sa); \
+ if ( s == 0 ) { \
+ res = (LI_)0; \
+ } else if ( s == 1) { \
+ res = (LI_)d[0]; \
+ } else { \
+ res = (LI_)d[0] + (LI_)d[1] * 0x100000000LL; \
+ if ( s < 0 ) { \
+ res = (LI_)-res; \
+ } \
+ } \
+ (r) = res; \
}
/* Conversions */
#define isEmptyMVarzh(r,a) r=(I_)((GET_INFO((StgMVar*)(a))) == &EMPTY_MVAR_info )
EF_(newMVarzh_fast);
EF_(takeMVarzh_fast);
+EF_(tryTakeMVarzh_fast);
EF_(putMVarzh_fast);
r = RET_STGCALL1(StgStablePtr,getStablePtr,a)
#define deRefStablePtrzh(r,sp) do { \
- ASSERT(stable_ptr_table[sp & ~STABLEPTR_WEIGHT_MASK].weight > 0); \
- r = stable_ptr_table[sp & ~STABLEPTR_WEIGHT_MASK].addr; \
+ ASSERT(stable_ptr_table[stgCast(StgWord,sp) & ~STABLEPTR_WEIGHT_MASK].weight > 0); \
+ r = stable_ptr_table[stgCast(StgWord,sp) & ~STABLEPTR_WEIGHT_MASK].addr; \
} while (0);
#define eqStablePtrzh(r,sp1,sp2) \
- (r = ((sp1 & ~STABLEPTR_WEIGHT_MASK) == (sp2 & ~STABLEPTR_WEIGHT_MASK)))
+ (r = ((stgCast(StgWord,sp1) & ~STABLEPTR_WEIGHT_MASK) == (stgCast(StgWord,sp2) & ~STABLEPTR_WEIGHT_MASK)))
#endif
#define ForeignObj_CLOSURE_DATA(c) (((StgForeignObj *)c)->data)
-EF_(makeForeignObjzh_fast);
+EF_(mkForeignObjzh_fast);
#define writeForeignObjzh(res,datum) \
(ForeignObj_CLOSURE_DATA(res) = (P_)(datum))