C语言实现xtime运算

话不多说,直接上代码

#include <stdio.h>
#include <stdlib.h>
unsigned char XTIME(unsigned int x)
{
    //*******************Begin*******************
        // printf("%x\n",x);
    unsigned char temp, result;
    int x1 = 0x1b;
    temp = x << 1;
    if (x > 99)
    {
        result = temp ^ x1;
    }
    else
    {
        return temp;

    }
    
    
    return result;
        //*********************End********************0xb5
}

int main()
{
    unsigned int a;
    scanf_s("%x", &a);
    printf("0x%x\n", XTIME(a));
    return 0;
}

这个算法我是参考这个大佬的博客实现的

https://blog.csdn.net/lplp9822/article/details/80906583

posted @ 2020-06-04 14:28  EZ4s1mple  阅读(1050)  评论(0)    收藏  举报