[greenstone-devel] cast precision errors throw mgpp build in 64 bits

From Anson Parker
DateSat, 6 Oct 2007 22:50:11 -0400
Subject [greenstone-devel] cast precision errors throw mgpp build in 64 bits
Hi - i'm really trying to debug this - it's bit over my head though...

so the general error for building mgpp in 64 bits is.....

text.pass1.cpp: In function ‘int done_text_1(const TagInfo&, char*)’:
text.pass1.cpp:375: error: cast from ‘double*’ to ‘unsigned int’ loses precision
text.pass1.cpp:375: error: cast from ‘double*’ to ‘unsigned int’ loses precision
text.pass1.cpp:381: error: cast from ‘double*’ to ‘int’ loses precision
text.pass1.cpp:381: error: cast from ‘double*’ to ‘int’ loses precision

so going to text.h and changing num_byte to an int or long doesn't fix this...

now looking at netorder.h

#define HTOND(d)                                                             
        do {                                                                 
             unsigned long tmph, tmpl;                                       
         memcpy ((void *) &tmph, (const void *) &d, sizeof(double) >> 1);
         memcpy ((void *) &tmpl, (const void *) ((unsigned int) &d + (sizeof(double) >> 1)), sizeof (double) >> 1);  
         tmph = htonl (tmph);                                            
         tmpl = htonl (tmpl);                                            
         memcpy ( (void *) &d, (const void *) &tmpl, sizeof (double) >> 1);                          
         memcpy ((void *) ((unsigned int) &d + (sizeof(double) >> 1)), (const void *) &tmph, sizeof (double) >> 1);  
    }while(0)

to see what can be tweaked to get this computer to comply and compile :)


Aloha ya'll

Climb to the top of the charts!  Play Star Shuffle:  the word scramble challenge with star power. Play Now!