[OSM-dev] Is YOUR code 64 bit proof?

Dane Springmeyer dane at dbsgeo.com
Sun Dec 30 02:30:06 GMT 2012


Thanks Frederik,

Mapnik 2.2.x will have full support for 64bit integers across the codebase:

https://github.com/mapnik/mapnik/issues/1662
https://github.com/mapnik/mapnik/pull/1661

Dane


On Dec 27, 2012, at 5:55 AM, Frederik Ramm wrote:

> Hi,
> 
>   another 62 million nodes and we'll have IDs of more than 2^31-1 which means than software using a simple, 32-bit, signed integer will not be able to process the data any longer.
> 
> If you're using C or similar compiled languages and have used as simple "int" for your IDs, it is likely that node IDs above 2**31-1 will appear as large negative numbers, and node IDs above 2**32 will appear as 1, 2, 3 etc.
> 
> Needless to say, this, if undetected, is likely to cause all sorts of strange effects.
> 
> The quick fix is to switch from signed to unsigned integers which would give you a little more breathing room; but you lose the ability to process files with negative IDs like those created by JOSM when you add new objects. The better fix is to switch to real 64bit integers at least for node IDs; of course this might increase your memory requirement if you're keeping a lot of nodes around.
> 
> (If you are using Osmium then you can patch it by changing the osm_object_id_t from int32_t to int64_t in include/osmium/osm/types.hpp.)
> 
> I've commited to SVN a couple of files with large node IDs so that you can quickly check your own programs or those you're using:
> 
> http://svn.openstreetmap.org/misc/64bit_testdata/
> 
> There's a README there.
> 
> Happy testing,
> Frederik
> 
> -- 
> Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"
> 
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/dev




More information about the dev mailing list