/************************整数运算功能函数****************************/
/*
get_byte(x, n);
logical_shift(x, n);
bit_cnt(x);
not(x);
tmin();
fits_bits(x, n);
neg(x);
is_postive(x);
is_le(x, y);
*要求:
*可以使用任何运算符以及循环判断语句,但不能直接用对应的运算符直接获得结果
*/
/*
* get_byte - 从x中提取指定的字节n
* 字节编号: 从0 (LSB) 到 3 (MSB)
* Ex: get_byte(0x12345678,1) = 0x56
*/
#include<stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int get_byte(int x, int n) {
int i;
unsigned char m;
for(i=0;i<=n;i++){
m=((x>>8*i)&0xFF);
}