Re: Towards 64bit DataHandles



   Hi!

On Fri, Jan 20, 2006 at 11:48:33PM +0100, Tim Janik wrote:
> >Index: sfi/sfitypes.h
> >===================================================================
> >RCS file: /cvs/gnome/beast/sfi/sfitypes.h,v
> >retrieving revision 1.17
> >diff -u -p -r1.17 sfitypes.h
> >--- sfi/sfitypes.h	20 May 2004 12:23:17 -0000	1.17
> >+++ sfi/sfitypes.h	20 Jan 2006 20:19:48 -0000
> >@@ -25,14 +25,30 @@ G_BEGIN_DECLS
> >
> >
> >/* --- Sfi typedefs --- */
> >+
> >+/* 64 bit types - FIXME: assert in configure script that sizeof (long 
> >long) == 8 */
> >+typedef long long               sfi_int64;
> >+typedef unsigned long long      sfi_uint64;
> >+#define SFI_MININT64            (0x8000000000000000LL)
> >+#define SFI_MAXINT64            (0x7fffffffffffffffLL)
> >+#define SFI_MAXUINT64           (0xffffffffffffffffULL)
> >+
> >+#if (1) /* internal: do not make these available when compiling third 
> >party code */
> >+#define int64                   sfi_int64
> >+#define uint64                  sfi_uint64
> >+#define MININT64                SFI_MININT64
> >+#define MAXINT64                SFI_MAXINT64
> >+#define MAXUINT64               SFI_MAXUINT64
> >+#endif
> >+
> 
> eek, the above is a mess, but can go in as a temporary measure
> (albeit with as little definitions/typedefs as possible) until
> i commit a wider range of new typedefs.
> also, you should decide on what constants you want, in the above
> code, you used G_MAXINT64, and here you define SFI_MAXINT64 and
> MAXINT64, allthough we already have SFI_MAXNUM.
> 
> best is probably to keep using G_MAXINT64 and not define SFI_MAXINT64
> or MAXINT64 at all.

Ok, I followed your advice, and omitted introducing any new MIN/MAXINT
defines. The typedefs I added look now like:

/* 64 bit types - FIXME: assert in configure script that sizeof (long long) == 8 */
typedef long long               sfi_int64;
typedef unsigned long long      sfi_uint64;

#if (1) /* internal: do not make these available when compiling third party code */
#define int64                   sfi_int64
#define uint64                  sfi_uint64
#endif

Just change them in the way you like. That I only conditionally #define
int64 here is intended for generated code like bstgenapi.h, which
includes <sfi/sfi.h>. We probably don't want to introduce int64 without
namespace into code only using the BSE C API (could be third party
code).

The condition is still missing though, just add it if you have reshaped
things the way you like.

> >typedef gboolean		SfiBool;
> >typedef gint			SfiInt;
> >#define	SFI_MAXINT		(+2147483647)
> >#define	SFI_MININT		(-SFI_MAXINT - 1)
> >-typedef gint64			SfiNum;
> >-#define	SFI_MAXNUM		((SfiNum) +9223372036854775807LL)
> >-#define	SFI_MINNUM		(-SFI_MAXNUM - 1)
> >-typedef gint64			SfiTime;
> >+typedef sfi_int64		SfiNum;
> >+#define	SFI_MINNUM		SFI_MININT64
> >+#define	SFI_MAXNUM		SFI_MAXINT64
> >+typedef sfi_int64		SfiTime;
> 
> but please don't mess with the existing definition, touvhing this
> code is entirely unneccessary for your changes.

Ok, so I committed my patch without these changes now. However, I
strongly recommend to redefine SfiNum and SfiTime to sfi_int64. Why?
Because the printf format string of gint64 is not constant across the
range of platforms BEAST can be compiled on (AMD64 => "%ld", i386 =>
"%lld").

   Cu... Stefan
-- 
Stefan Westerfeld, Hamburg/Germany, http://space.twc.de/~stefan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]