Henri Verbeet a écrit :
On 5 April 2010 20:28, Christian Costa titan.costa@wanadoo.fr wrote:
+inline ctab_constant* get_constant(D3DXHANDLE ptr) +{
- if (!ptr) return NULL;
- return (ctab_constant*)~(UINT)ptr;
+}
+inline D3DXHANDLE get_handle(ctab_constant* ptr) +{
- return (D3DXHANDLE)~((UINT)ptr);
+}
How is that different? You'd have to cast to UINT_PTR to fit a 64-bit pointer in there, although of course that only works if D3DXHANDLE is also a 64-bit value on 64-bit Windows (didn't check).
D3DXHANDLE maps to LPCSTR type so go for UINT_PTR.