Re: [PATCH 2/6] d3dx9_36: Beginning of constants parsing + tests (based on work from Luis Busquets) (try 2)
On 5 April 2010 20:28, Christian Costa <titan.costa(a)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).
Henri Verbeet a écrit :
On 5 April 2010 20:28, Christian Costa <titan.costa(a)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.
participants (2)
-
Christian Costa -
Henri Verbeet