Exercise 2-8.
2016-02-19 11:20
375 查看
Exercise 2-8.Write a function rightrot(x,n) that returns the value of the integer x rotated
to the right b y npositions.
to the right b y npositions.
int unsignedLength() { unsigned x = (unsigned)~0; int i = 0; while (x != 0) { x = x >> 1; i++; } return i; } unsigned rightrot(unsigned x, int n) { int l = unsignedLength(); int a, b, c; a = (~0) >> (l - n) | x; b = x >> n; c = a << (l - n); return b | c; }
相关文章推荐
- UiAutomator2自动化测试环境搭建
- hdu 1069 Monkey and Banana
- .NET 事务处理
- 五种JSP页面跳转方法详解
- C++ template —— 模板与继承(八)
- SeaJS学习(一)
- Elmah使用总结
- java如何避免死锁
- iOS SDK:预览和打开文件
- Inno Setup中控件的创建及事件响应
- 删除配置文件 Xcode->Code Signing->Provisioning Profile
- web开发功能权限控制
- VCC、VDD、VEE、VSS的区别
- 到底要不要拆分函数
- maven编译的时候排除junit测试类
- 古诗MySQL数据库中使用到的DAO模式
- 正则表达式简介
- 热更新相关
- 关于大型网站技术演进的思考(十三)--网站静态化处理―CSI(5)
- Android实现图片异步请求加三级缓存