How to extract the opcode and the data form the instruction? "instruction" is inst below in decimal. For some values of "??", I should be able to extract the opCode and data???

opCode = inst >>??;
data = inst & ??;

It is done on a x86 processor using C.
It is 16 bit in total.

Starting from 0 from the right to left.
11th to 15th bit is OpCode.

0 to 9th bit is Data.


Is there a shortcut using hexadecimal notation?

Something like

( opc >> 11 ) & 0x3f; // 6 bits
opc & 0x3ff;  // 10 bits
commented: yup (andor) +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.