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;
#define TN_SGA 0003
#define TN_PORT 23
+/* Some compiler can't cast u64 to double
+ * This function do the job for us:
+
+ * We use the highest bit for cast, this only
+ * works if the highest bit is not
+ * in use (This should not happen)
+ *
+ * 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
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;
#define ICS_ICC 1
#define ICS_FICS 2
#define ICS_CHESSNET 3 /* not really supported */
-int ics_type;\r
-\r
-/* unsigned int 64 for engine nodes work and display */\r
-#ifdef WIN32\r
- /* I don't know the name for this type of other compilers \r
- * If it not work just added here \r
- * Thats for MS Visual Studio \r
- */\r
- #define u64 unsigned __int64\r
- #define u64Display "%I64u"\r
-#else\r
- /* GNU gcc */\r
- #define u64 unsigned long long\r
- #define u64Display "%llu"\r
-#endif\r
-\r
+int ics_type;
+
+/* unsigned int 64 for engine nodes work and display */
+#ifdef WIN32
+ /* I don't know the name for this type of other compiler
+ * If it not work, just modify here
+ * This is for MS Visual Studio
+ */
+ #ifdef _MSC_VER
+ #define u64 unsigned __int64
+ #define s64 signed __int64
+ #define u64Display "%I64u"
+ #else
+ /* place holder
+ * or dummy types for other compiler
+ */
+ #define u64 unsigned __int64
+ #define s64 signed __int64
+ #define u64Display "%I64u"
+ #endif
+#else
+ /* GNU gcc */
+ #define u64 unsigned long long
+ #define s64 signed long long
+ #define u64Display "%llu"
+#endif
+
/* pgntags.c prototypes
*/