xboard-devel
[Top][All Lists]
Advanced

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

[XBoard-devel] Basic fix: FW: Compiling cvs winboard with MSVC


From: Daniel Mehrmann
Subject: [XBoard-devel] Basic fix: FW: Compiling cvs winboard with MSVC
Date: Sun, 25 Apr 2004 06:17:03 +0200

Hello again with the same problem,

i determined that my suggestion don't work with newer microsoft visual
studio's after 6.0 SP5.
The new servicepack 6 for msvc 6.0 disable the processorpack too.

So i wrote a little basic code to fix the problem for ever. 
And now we used this code for all compilers because i think it's a good
idea to have the same basics :)
I don't like to much special compiler code too.

I will checkin in the next hours this:

--- xboard/backend.h    2004-02-15 03:29:36.000000000 +0100
+++ xboard.ready/backend.h      2004-04-25 06:00:03.296875000 +0200
@@ -178,15 +178,17 @@
 
 /* unsigned int 64 for engine nodes work and display */
 #ifdef WIN32
-       /* I don't know the name for this type of other compilers 
-        * If it not work just added here 
-        * Thats for MS Visual Studio 
+       /* I don't know the name for this type of other compilers
+        * If it not work just added here
+        * Thats for MS Visual Studio
         */
-       #define u64     unsigned __int64
+       #define u64 unsigned __int64
+       #define s64 signed __int64
        #define u64Display  "%I64u"
 #else
        /* GNU gcc */
-       #define u64     unsigned long long
+       #define u64 unsigned long long
+       #define s64 signed long long
        #define u64Display  "%llu"
 #endif
 

--- xboard/backend.c    2004-04-03 22:44:00.000000000 +0200
+++ xboard.ready/backend.c      2004-04-25 05:42:15.140625000 +0200
@@ -212,10 +212,12 @@
 void InitBackEnd3 P((void));
 void FeatureDone P((ChessProgramState* cps, int val));
 void InitChessProgram P((ChessProgramState *cps));
+double u64ToDouble P((u64 value));
 
 #ifdef WIN32
        extern void ConsoleCreate();
 #endif
+
 extern int tinyLayout, smallLayout;
 static ChessProgramStats programStats;
 
@@ -258,6 +260,21 @@
 #define TN_SGA  0003
 #define TN_PORT 23
 
+/* Some compilers don't cast u64 to double
+ * This function do the job for us
+ * We used this for all compiler
+ */
+double
+u64ToDouble(u64 value)
+{
+  double r;
+  u64 tmp = value & 0x7fffffffffffffff;
+  r = (double)(s64)tmp;
+  if (value & 0x8000000000000000)
+       r +=  9.2233720368547758080e18; /* 2^63 */
+  return r;
+}
+
 /* Fake up flags for now, as we aren't keeping track of castling
    availability yet */
 int
@@ -9251,8 +9268,8 @@
     if (programStats.got_only_move) {
        strcpy(buf, programStats.movelist);
     } else {
-       nps = (((u64)programStats.nodes) /
-              (((double)programStats.time)/100.0));
+       nps = (u64ToDouble(programStats.nodes) /
+              ((double)programStats.time /100.0));
 
        cs = programStats.time % 100;
        s = programStats.time / 100;



-----Original Message-----
From: Daniel Mehrmann [mailto:address@hidden 
Sent: Tuesday, April 20, 2004 5:20 AM
To: 'address@hidden'
Cc: 'address@hidden'
Subject: Compiling cvs winboard with MSVC


Hello,

i heard from a lot of people they have problems to compile the current 
cvs winboard version with Microsoft Visual Studio. 

They got the follow error message: (sorry german version, but the vars
should be the same)

cl -c -W3 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -D_WINNT
-D_WIN32_WINNT=0x0400 -D_WIN32_IE=0x0300 -DWINVER=0x0400 -DWIN32
-D_WIN32 -I. -I.. -DWINVER=0x0400 -Z7 -Od ../backend.c backend.c
../backend.c(9255) : error C2520: Konvertierung von unsigned __int64 in
double nicht implementiert, verwenden Sie signed __int64

The problem is so far that Microsoft goes their own special way for
unsigend/sigend 64bit types. 
Of course we have the problem too, that we haven't yet a ANSI C standard
for 64bit.

So the workaround for that problem is to install the free public
"Processor Pack" AddOn for Visual Studio from Microsoft. 

Here is a download link:
http://msdn.microsoft.com/vstudio/downloads/tools/ppack/download.aspx

--
Daniel Mehrmann 

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]