Hexadecimal knowledge point summary complement original code anticode

Source: Internet
Author: User

The positive complement is the same as the reverse code.

The negative number is used to remove the symbol bit.

The complement of the negative number is the reverse code + 1


Obtain the source code

Obtain the source code by checking the reverse code and then completing the code.


Whether positive or negative, it is stored in the memory as a complement.



1. hexadecimal

It is a carry-in method defined by people. for any kind of hexadecimal-x notation, it indicates that the number operation at a certain position is a one-digit operation on X.

Decimal: 10 to one, hexadecimal: Sixteen to one, binary: two to one

Binary. hexadecimal is a common encoding method in computers.


The binary four bits are equivalent to the hexadecimal one.

The binary three digits are equivalent to the octal one.

Convert n to decimal

Tip: the number of digits in the current bit multiplied by the number of digits in the base (n) minus one square

0x17 hexadecimal

017 octal

17 decimal

0b17 binary

Bit = bit, which means binary bit

B = byte means byte, one byte = 8bit

1 MB is 1 mbite.

Download speed: 1024/8 = kb/s

1 megabits = 1 M bit, 1B = 8 bit, so 1 megabits = 1/8 MB


2. bitwise operations

The amount involved in the operation is calculated in binary format.

Bitwise AND &, bitwise OR |, bitwise NOT ~, Shifts left by bit or ^ (delimiters) <, shifted right>

<Shifts one digit to the left is equivalent to multiplying 2,> shifts one digit to the right is equal to dividing by 2.

One byte represents eight binary bits (BIT)

The value range of a byte is 0 ~ 255


One of the bitwise AND functions is to clear the location data

Exclusive or: the integer variable is different or (1 if the value is 0 if the value is the same)


Use an exclusive or exchange the values of two variables

0 at the end of Left shift in Shift


Logical shift: Ignore Positive and Negative Numbers

Arithmetic shift: Consider plus or minus signs.


Right Shift operation for negative numbers, divided into logical right shift (high complement 0), arithmetic right shift (high complement 1)

1. int A = 5; // 4 bytes, 32 binary digits

Source code/Supplemental code:

0000 0000 0000 0000 0000 0000 0000


Hexadecimal knowledge point summary complement original code anticode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.