hi, I need to translate from C the following macro: #define CTL_CODE( DeviceType, Function, Method, Access ) ( ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) ) but i'm not sure of the meaning of || (should be or) and i don't know the meaning of << Could anyone kindly help me ? Thx ! angelo
Posted on 2001-04-22 15:40:00 by angelo
| means OR indeed. << is bit shift left (same as the SHL opcode)

#define CTL_CODE( DeviceType, Function, Method, Access ) ( ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)
So in masm this would be:

CTL_CODE MACRO DeviceType, Function, Method, Access
    mov eax, (DeviceType SHL 16) or\
             (Access SHL 14) or\
             (Function SHL 2) or\
             Method
ENDM
In the macro above, SHL is not an opcode, it is an operator in masm that does the same as << in C. Thomas
Posted on 2001-04-22 15:55:00 by Thomas
thanks
Posted on 2001-04-22 16:03:00 by angelo