[ scummvm-Patches-2685623 ] Pointer casts on LLP64 platforms lose precision

SourceForge.net noreply at sourceforge.net
Thu Mar 12 21:55:50 CET 2009


Patches item #2685623, was opened at 2009-03-12 21:55
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=2685623&group_id=37116

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Andre Heider (dhewg)
Assigned to: Nobody/Anonymous (nobody)
Summary: Pointer casts on LLP64 platforms lose precision

Initial Comment:
With mingw-w64 (gcc version 4.4.0 20090308 (experimental) (GCC)) a few of these errors occur:

backends/platform/sdl/graphics.cpp:1000: error: cast from ‘const byte*’ to ‘long int’ loses precision

64bit MS platforms use the LLP64 data model, so a "long" is only 32bit wide. There're a few instances where pointers get casted to long (to check for alignment), and that results in the above mentioned error.

While that can be worked around with -fpermissive, it's not really a nice solution, so I'll attach a patch that changes those casts from long to size_t. It compiled just fine afterwards (all engines enabled). Maybe it would be better idea to provide an common inline function to check for the alignment of a pointer.

Btw: It's working too ;) I don't have a win64 box, but Hkz just played BS/PSX on Vista64 with that binary.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=2685623&group_id=37116




More information about the Scummvm-tracker mailing list