How can express of result value in decimal

0

I'd like to express the A and B values(binary) in decimal numbers. please tell me what to do !!!! thank you !!

#include <stdio.h>

void do_cpuid(int, int*);


int main() {

    int addr = 0;
    int cnt = 32;

    do_cpuid(0x80000008, &addr);

    int i, j,k;
    int result[20];

    for (i = 0; addr > 0; i++)
    {
        result[i] = addr % 2;
        addr = addr / 2;
    }

    printf("A: ");
    for (j = i - 1; j >= 0; j--)
    {
        if (j >= 0 && j < 8) {
            printf(" %d", result[j]);
        }

    }
    printf("\n");
    printf("B: ");
    for (k = i - 1; k >= 0; k--)
    {
        if (k >= 8 && k < 16) {
            printf(" %d", result[k]);
        }
    }

}

void do_cpuid(int input, int* addr) {
    int reg_ax;

    __asm {
        mov eax, input;
        cpuid;
        mov reg_ax, eax;
    }
    *addr = reg_ax;
}
c
decimal
asked on Stack Overflow Oct 12, 2019 by user12206252 • edited Oct 12, 2019 by Robert

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0