#include "stdint.h" #include "head.h" // 无符号大小比较 void test1(uint32_t a,uint32_t b){ if(a>b){ my_printf("%u>%u\n",a,b); }else if(ab){ my_printf("%d>%d\n",a,b); }else if(ab){ my_printf("%u>%u\n",a,b); }else if(ab){ my_printf("%d>%d\n",a,b); }else if(ab){ my_printf("%u>%u\n",a,b); }else if(ab){ my_printf("%d>%d\n",a,b); }else if(a>b); } void test8(int32_t a,int b){ my_printf("shift right %08x, %08x\n",a,a>>b); } void test9(uint16_t a,int b){ my_printf("shift right %08x, %08x\n",a,a>>b); } void test10(int16_t a,int b){ my_printf("shift right %08x, %08x\n",a,a>>b); } void test11(uint8_t a,int b){ my_printf("shift right %08x, %08x\n",a,a>>b); } void test12(int8_t a,int b){ my_printf("shift right %08x, %08x\n",a,a>>b); } void cpu_test() { my_printf("test 32 bit\n"); test1(1,2); test1(1,-2); test2(1,2); test2(1,-2); my_printf("test 16 bit\n"); test3(1,2); test3(1,-2); test4(1,2); test4(1,-2); my_printf("test 8 bit\n"); test5(1,2); test5(1,-2); test6(1,2); test6(1,-2); my_printf("shift test\n"); test7(0x80000000,7); test8(0x80000000,7); test9(0x8000,7); test10(0x8000,7); test11(0x80,7); test12(0x80,7); }