First, the second chapter textbook "representation and processing of information" learning content summary
1. Information storage:
! The computer representation of several different binary encoded value, the binary signal can be easily represented, stored and transmitted.
! Multi-byte objects are stored as a consecutive sequence of bytes, the byte address of the object is the smallest addresses.
! It represents an arrangement of two-byte object general rule. Some of the machines selected in memory objects stored in the order from the least significant byte to most significant byte, referred to as a little-endian; others machines stored in the order from the most significant byte to least significant byte, referred to big or little endian.
2. Boolean
algebra: ! The logical values TRUE
and FALSE
encoded as a binary 1 and 0, the algebraic been devised.
! Boolean function by operators ~
, &
, |
and ^
represent logical operations not
, AND
, OR
and EXCLUSIVE-OR
.
! Boolean operations can be extended operation in place of the vector.
3.C language in bit-level operations:
! Boolean operations: it supports the features of the C language bitwise Boolean operations, Boolean operations of various operators can apply to any "plastic" data type.
! The masked: this mask is a bit pattern representing a collection of bits from a word. Such x=0x89ABCDEF
that expression will be 0x000000EF
.
4.C language of logic operations:
! Logical ||
operators: , &&
, and !
, and OR
, AND
, NOT
operation corresponds.
! If a logical operation parameter evaluates the expression can be determined, would not have a second parameter evaluation.
5.C language shift operation:
! And arithmetic logical shift right.
! For unsigned number, it must be the right logic.
6. unsigned code:
! 0~2w-1
We have between a w
value of coded bits. I.e., non-uniqueness of the number of symbols coded.
7. complement
code: ! We need to represent the number of breaks, the computer represents a signed number, need complement form.
! Principle: The negative interpretation of the right to the most significant bit-bit word B2Tw
, bit its weight -2w-1
. (See textbooks P45).
! Complement encoding also unique.
8. The anti-code and the original code symbol is another number two standard representation. (See textbooks P47).
9. integer
arithmetic: ! Unsigned addition.
! Complement addition.
! Non-complement.
! Unsigned multiplication.
! Complement multiplication.
10. Float:! IEEE floating point format of the digital representation.
Second, the problems encountered in the process of learning this week, and the settlement process
1. Question: What is refers to integer arithmetic overflow, with any way to avoid?
Resolution: The current understanding is that if 2^(w+1)> x+y ≥ 2^w
, then integer arithmetic overflow. If the operand is unsigned, for c = a + b
, when c < a || c < b
the overflow occurred.
The following methods can avoid overflow: by detecting, if the number of overflow by subtracting the engagement 2^w
or to find a larger value modulo operation.
2. Problems: C language shaped support all data types are signed and unsigned arithmetic, and allows to make cast between different data types. He in the end is a kind of conversion rules and way of doing things?
Solution: Explicit cast:
`` `int TX, TY;
unsigned UX, UY;
tx = (int) ux;
uy = (unsigned) ty;```
隐式的强制转换:
```int tx,ty;
unsigned ux,uy;
tx = ux; /* Cast to signed */
uy = ty; /* Cast to unsigned */ ```
当执行一个运算时,如果它的一个运算数式有有符号的而另一个式无符号的,那么C语言会隐式地将有参数强制类型转换位无符号数,并假设这两个数都是非负的,来执行这个运算。
Third, code hosting
Fourth, last week summed up the wrong questions
5. Learn the progress bar