correct pointer hash for 64bits archs New pointer hashing function to prevent a warning on architectures where sizeof(int)!=sizeof(void*). Should produce the same optimized code on other platforms. Patches applied: * ddaa@ddaa.net--2004-texmacs/texmacs--devo--1.0.4--patch-8 correct pointer hash for 64bits archs --- ./src/Classes/Abstract/basic.hpp +++ ./src/Classes/Abstract/basic.hpp @@ -81,9 +81,22 @@ inline double min (double i, double j) { if (ij) return i; else return j; } inline int hash (int i) { return i; } -inline int hash (pointer ptr) { return (int) ptr; } inline int copy (int x) { return x; } +inline int +hash (pointer ptr) { + // This algorithm degenerates gracefully when sizeof(pointer)==sizeof(int) + const int n= sizeof(pointer) / sizeof(int) + + + (0 != sizeof(pointer) % sizeof(int) ? 1 : 0); + union { int i[n]; pointer p; } u; + if (0 != sizeof(pointer) % sizeof(int)) u.i[n-1]= 0; + u.p= ptr; + int h= hash(u.i[0]); + for (int j=1; j>25))); + return h; +} + enum display_control { INDENT, UNINDENT, HRULE, LF }; ostream& operator << (ostream& out, display_control ctrl);