家庭作业2.68 2.70
家庭作业2.68
题目:写出具有如下原型的代码
/*
*Clear all but least signficant n bit of x
*Examples:x = 0x78abcdef,n = 8--> 0xef,n = 16 -->0xcdef;
*Assume 1<= n <= w
*/
int lower_bits(int x,int n)
函数应该遵循位级整数编码规则
代码截图:
运行结果:
家庭作业2.70
题目:写出具有如下原型的代码
/*
*Return 1 when x can be respresented as an n-bit,2'scomplement
*number;0 otherwise
*Assume1 <= n <=w;
*/
函数应遵循整数编码规则