I searched the board and did not find much on converting enums. This is what I'm trying to convert:


/* Pool types */
typedef enum _D3DPOOL {
D3DPOOL_DEFAULT = 0,
D3DPOOL_MANAGED = 1,
D3DPOOL_SYSTEMMEM = 2,
D3DPOOL_SCRATCH = 3,

D3DPOOL_FORCE_DWORD = 0x7fffffff
} D3DPOOL;

I must admit, that I dont really know what an enum is and why you would want to use one vs some other data structure. When this enum is used in C++ code, it looks like it just the value ont the stack. Or to putting another way, it looks like a structer for numeric equates :confused:

Thanks.
Posted on 2003-03-30 01:02:15 by ThoughtCriminal
Afternoon, ThoughtCriminal.

It *is* a structure for numeric equates.:tongue:

You could always forget the structure and have something like this instead:


D3DPOOL_DEFAULT equ 0
D3DPOOL_MANAGED equ 1
D3DPOOL_SYSTEMMEM equ 2
D3DPOOL_SCRATCH equ 3


Cheers,
Scronty
Posted on 2003-03-30 01:49:13 by Scronty
Thanks Scronty.


Lucky guess by me :grin:
Posted on 2003-03-30 03:31:14 by ThoughtCriminal
One more thing to add: In MASM if you write your equate like this:


D3DPOOL_DEFAULT equ <DWORD PTR 0>
D3DPOOL_MANAGED equ <DWORD PTR 1>
D3DPOOL_SYSTEMMEM equ <DWORD PTR 2>
D3DPOOL_SCRATCH equ <DWORD PTR 3>
...then masm will know that these equates are DWORD size when you move them to memory. For example, you can code:
mov [esp], D3DPOOL_SCRATCH
...instead of...
mov DWORD PTR [esp], D3DPOOL_SCRATCH
This might help or not -- usually the constants are moved to a structure that has already been defined and then the DWORD PTR is redundant, but it works either way. MASM will error if they do not match. So, it does provide a little protection in rare cases.
Posted on 2003-03-30 10:26:47 by bitRAKE