An introduction to bitwise operators
2007-12-15 20:37
375 查看
读了codeproject上的这篇《An introduction to bitwise operators》,前面两个运算符说得不错,但第三个异或运算符感觉不够准确,作者给出的示例不知道有什么用处,不就是把数做了两次异或又回来了么?
&运算符用来判定某些位是0还是1:
#include <iostream>
using namespace std;
int main(void)
#include <iostream>
using namespace std;
int main(void)
异或运算符最常用的应该是用其实现两个数的交换:
#include <iostream>
using namespace std;
int main(void)
将取反运算符和与运算符结合起来,可以对某些位置零:
#include <iostream>
using namespace std;
int main(void)
最后的位域有一个问题没搞懂:
#include <iostream>
using namespace std;
struct date_struct
int main(void)
我已经设置day和month各自占据4位,应该是可以满足的,可结果却都是-8,why?
&运算符用来判定某些位是0还是1:
#include <iostream>
using namespace std;
int main(void)
#include <iostream>
using namespace std;
int main(void)
异或运算符最常用的应该是用其实现两个数的交换:
#include <iostream>
using namespace std;
int main(void)
将取反运算符和与运算符结合起来,可以对某些位置零:
#include <iostream>
using namespace std;
int main(void)
最后的位域有一个问题没搞懂:
#include <iostream>
using namespace std;
struct date_struct
int main(void)
我已经设置day和month各自占据4位,应该是可以满足的,可结果却都是-8,why?
相关文章推荐
- An introduction to bitwise operators
- Python 入门教程 16 ---- Introduction to Bitwise Operators
- An Introduction to WebDriver Using the JavaScript Bindings
- Beyond the C++ Standard Library: An Introduction to Boost: Björn Karlsson: 9780321133540: Amazon.com: Books
- GradientPanel and AlphaLabel: an introduction to building controls
- An Introduction to GraphViz and dot
- Quiz 6b Question 7————An Introduction to Interactive Programming in Python
- Brian Myers, «Foundations of WF: an Introduction to Windows Workflow Foundation (Expert's Voice in .Net)
- An Introduction to Tkinter (Work in Progress)
- An Introduction to Functional Languages
- 【coursera 学习笔记】An Introduction to Interactive Programming in Python--week0
- 【coursera 学习笔记】An Introduction to Interactive Programming in Python--week1
- An introduction to numerical analysis theorem 6.3 :Hermite Interpolation Theorem
- 读书摘录 - "An Introduction to Software Architecture"
- C#数据结构和算法[An Introduction to Collections, Generics, and the Timing Class]
- An Introduction To Ajax
- An Introduction to Dynamic Management Views and Functions in SQL Server 2005
- Mini-project # 4 - "Pong"___An Introduction to Interactive Programming in Python"RICE"
- Windows Streams - An Introduction to File System Streams