Christian Costa titan.costa@wanadoo.fr writes:
@@ -650,6 +650,29 @@ HRESULT WINAPI D3DXCompileShader(LPCSTR pSrcData, return D3DERR_INVALIDCALL; }
+typedef struct ctab_constant ctab_constant;
+struct ctab_constant {
- D3DXCONSTANT_DESC desc;
- ctab_constant* members;
+};
+inline ctab_constant* get_constant(D3DXHANDLE ptr) +{
- if (!ptr) return NULL;
- return (ctab_constant*)~((UINT_PTR)ptr);
+}
+inline D3DXHANDLE get_handle(ctab_constant* ptr) +{
- return (D3DXHANDLE)~((UINT_PTR)ptr);
+}
+inline BOOL isstring(D3DXHANDLE ptr) +{
- return !(((UINT_PTR)ptr) & (1 << (sizeof(UINT_PTR)*8-1)));
+}
This is broken, you can't make assumptions about the high bit of pointer values. The handle management needs more thought.
Message du 09/04/10 11:33 De : "Alexandre Julliard" A : "Christian Costa" Copie à : wine-devel@winehq.org Objet : Re: [PATCH] d3dx9_36: Beginning of constants parsing + tests (based on work from Luis Busquets) (try 3) (resend)
Christian Costa writes:
@@ -650,6 +650,29 @@ HRESULT WINAPI D3DXCompileShader(LPCSTR pSrcData, return D3DERR_INVALIDCALL; }
+typedef struct ctab_constant ctab_constant;
+struct ctab_constant {
- D3DXCONSTANT_DESC desc;
- ctab_constant* members;
+};
+inline ctab_constant* get_constant(D3DXHANDLE ptr) +{
- if (!ptr) return NULL;
- return (ctab_constant*)~((UINT_PTR)ptr);
+}
+inline D3DXHANDLE get_handle(ctab_constant* ptr) +{
- return (D3DXHANDLE)~((UINT_PTR)ptr);
+}
+inline BOOL isstring(D3DXHANDLE ptr) +{
- return !(((UINT_PTR)ptr) & (1 << (sizeof(UINT_PTR)*8-1)));
+}
This is broken, you can't make assumptions about the high bit of pointer values. The handle management needs more thought.
-- Alexandre Julliard julliard@winehq.org
Does a 16-bit index would be suitable ?