In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "the basic concept and calculation process of c#bit operation". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn "the basic concepts and calculation process of c#bit operation"!
preface
Some very basic things are not used in practical work and are rarely used. Once encountered, they don't know what to say. Recently encountered a problem, an int16 (short), two bool variables into an int32 (int), when I heard this request, my first reaction is not the wrong demand, but later found that I am incompetent, here we need bit operation-related concepts.
Here are a few basic concepts.
Bit, byte, character (English letter), Chinese character, KB, MB, GB, TB relationship
1. Bit: bit, also called bit, is the smallest unit of data represented by a computer, stored in binary 0 and 1
Byte:byte, 1byte (1B)=8b, one byte =8 bits
3. Character:char, 1char=2byte= 16b, 1 character =2 bytes =16 bits
4.KB,1KB=1024byte(1024B)
5.MB,1MB=1014KB
6.GB,1GB=1024MB
7TB,1TB=1024GB
A Chinese character takes up two bytes, that is, 16 bits. A 1000-word article is about 16*1000 binary zeros or ones.
A 10M Short Video, i.e. 10M = 1024KB *10= 1024bytes *10*10= 1024bits *8*10*10
That's about 919200 binary ones and zeros.
short is 16 bits, int is 32 bits, long is 64 bits
1. What is bitwise arithmetic?
Before mastering bitwise operations, you should know what bitwise operations are. What data types can be bit-operated on? What is the result of cloud computing?
1. The object of bit operation is int, char type, in short, the binary 1101 (13) operation
2. The result of a bitwise operation is an integer.
Symbol Meaning Operand Type Operation Result Type Example ~ Logic NOT Operation Integer, char Integer ~a& Logic AND Operation a&b| Logical OR operationsa| b22. Bit logical AND operation
An AND operation is an AND operation performed on two operands as they are located.
The rules are:
1&1=1
0&1=0
0&0=0
As shown in the figure:
The binary number for 15 is 0000 1111.
The binary number for 20 is 0001 0100.
15 &20 is 0000 0100, which is 4.
3. a bitwise logical disjunction
|A bitwise logical OR operation is to OR two operands bitwise. The rules of the operation are
1|1=1
1|0=1
0|0=0
such as 15| The result of 20 is 31, binary 0001 1111.
0000 1111 (binary of 15)| 0001 0100 = 0001 1111 The result is 31
4. bitwise logical exclusive OR operation
A ^-bit logical XOR operation is a bitwise XOR operation of two operands. The rule is:
1 XOR 1 equals 0
1 XOR 0 equals 1
0 XOR 0 equals 0
Same as 0, different as 1.
0000 1111 ^ 0001 0100= 0001 1011 The result is 27
5. bit logic left shift operation
Bit logical left shift operation is to shift a number of bits to the left according to the bit, and the empty part after the left shift is 0.
For example, 15 binary 0000 1111 left shift 8 bits is 1111 0000 0000 (15
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.