From 1ba5b64f99d74d912bc20ca8d6cc49796c15971c Mon Sep 17 00:00:00 2001 From: sof Date: Tue, 30 Jun 1998 12:09:44 +0000 Subject: [PATCH] [project @ 1998-06-30 12:09:44 by sof] typedefs for family of sized int types (along the lines of StgTypes.h in new rts sources, but using Word instead of Nat for unsigned ints) --- ghc/includes/StgTypes.lh | 53 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/ghc/includes/StgTypes.lh b/ghc/includes/StgTypes.lh index 24783ae..7c4d717 100644 --- a/ghc/includes/StgTypes.lh +++ b/ghc/includes/StgTypes.lh @@ -85,16 +85,16 @@ typedef unsigned long *StgPtr; /* StgPtr is a ptr to a heap object typedef StgPtr *StgPtrPtr; /* used for A stack pointer */ typedef long StgInt; -/* seven shorthand forms: - StgChar, StgWord, StgPtr, StgPtrPtr, StgInt, StgAddr, const StgPtr */ - -typedef unsigned char C_; -typedef unsigned long W_; -typedef unsigned long *P_; -typedef P_ *PP_; -typedef long I_; -typedef void *A_; -typedef const unsigned long *D_; +#if __GNUC__ +/* These types are only used to allow the passing of + 64-bit ints from Haskell to ccalls and to ease + the implementation of the Int64 and Word64 libraries. +*/ +typedef unsigned long long int StgWord64; +typedef long long int StgInt64; +typedef StgInt64 LI_; +typedef StgWord64 LW_; +#endif typedef unsigned char StgChar; typedef void *StgAddr; @@ -107,6 +107,29 @@ typedef float StgFloat; typedef double StgDouble; #endif +/* seven shorthand forms: + StgChar, StgWord, StgPtr, StgPtrPtr, StgInt, StgAddr, const StgPtr */ + +typedef StgChar C_; +typedef StgWord W_; +typedef StgPtr P_; +typedef P_ *PP_; +typedef StgInt I_; +typedef void *A_; +typedef const unsigned long *D_; + +/* Typedefs for the various sized ints + (ToDo: better.) +*/ + +typedef unsigned char StgWord8; +typedef signed char StgInt8; +typedef unsigned short StgWord16; +typedef short StgInt16; +typedef unsigned int StgWord32; +typedef signed int StgInt32; + + typedef StgPtr StgArray; typedef StgChar *StgByteArray; typedef StgByteArray B_; @@ -224,6 +247,16 @@ typedef union __dt unpacked_double du; } double_thing; +typedef union __it + { StgInt64 i; + unpacked_double iu; + } int64_thing; + +typedef union __wt + { StgWord64 w; + unpacked_double wu; + } word64_thing; + typedef StgWord unpacked_float; typedef union __ft -- 1.7.10.4