Last active
October 24, 2023 05:50
-
-
Save ghostrider-reborn/bfd3e9c6ea468b92ca0251c7462757b5 to your computer and use it in GitHub Desktop.
Extract major and minor value from QTI perf opcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define EXTRACT_MAJOR_TYPE 0x1FC00000 | |
#define EXTRACT_MINOR_TYPE 0x000FC000 | |
#define SHIFT_BIT_MAJOR_TYPE 22 | |
#define SHIFT_BIT_MINOR_TYPE 14 | |
int main() | |
{ | |
unsigned int opcode; | |
unsigned char major, minor; | |
printf("Enter opcode in hex: "); | |
scanf("%x", &opcode); | |
major = (opcode & EXTRACT_MAJOR_TYPE) >> SHIFT_BIT_MAJOR_TYPE; | |
minor = (opcode & EXTRACT_MINOR_TYPE) >> SHIFT_BIT_MINOR_TYPE; | |
printf("major=0x%X minor=0x%X", major, minor); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment