Representation and processing of information
First, information storage.
1. Digital representation
Unsigned encoding based on binary notation
Complement code has positive negative
Floating-point encoding
2. Information storage
In binary notation, its value is 00000000 (2) ~11111111 (2), or 0 (10) ~255 (10) in decimal notation;
Hexadecimal representation: A numeric constant beginning with the 0X or ox. )
Word length: Indicates the nominal size of the integer and pointer data.
The most important system parameter determined by the word length is the maximum size of the virtual address space.
Addressing and byte order:
Typically, multibyte objects are stored as contiguous sequence of bytes, with the object address being the smallest address in the bytes used.
The small-end method----the least significant byte in the front way;
The big-endian----the highest effective byte in the front way;
Two-terminal method used by many microprocessors
Disassembler: A tool that determines the sequence of instructions represented by an executable program file.
Represents a String
The string in C is encoded as an array of characters at the end of a null (value of 0) character. Each character is represented by a standard encoding. The most common is the ASCII code.
Simplest Boolean algebra Two-tuple set {0,1}
bit vectors : A string with a fixed length of W, 0 and 1. A bit-vector operation can be defined as an operation between each corresponding element of a parameter. Collection Encoding
bitwise arithmetic : Implements a mask operation, where the mask is a bit pattern that represents a collection of bits selected from a word.
The best way to determine the result of a bit-level expression is to extend the hexadecimal parameter to the binary representation and perform the binary operation, and then convert back to 16 binary.
Logical operations
The logical operation considers all nonzero parameters to represent true, while parameter 0 represents false. They return 1 or 0; bitwise operations are limited to 0 or 1 o'clock in special cases.
Difference 2: If you evaluate the first parameter, you can determine the result of the expression, then the logical operation will not evaluate the second parameter. The C language standard does not explicitly define which type of right shift should be used, and for unsigned data, the right shift must be logical. For signed data, the right shift of arithmetic or logic is possible. Virtually all compiler/machine combinations use arithmetic right shifts for signed data, and many programmers assume that this right shift is used by the machine.
Second, an integer representation.
Integer data type
Two ways to encode integers with bits: one can only represent non-negative numbers, and the other can only represent negative numbers, 0, and positive numbers.
Integer data Type--an integer representing a finite range, each of which can be specified with a keyword, while the number of allocated bytes of different sizes varies depending on the length of the machine and the compiler.
Depending on the byte allocation, the range of values that can be represented by different sizes is different.
Unsigned number encoding
Conversion between signed and unsigned numbers
The principle of conversion is that the underlying bit representation remains the same
0 extension-Converts an unsigned number to a larger data type, representing the beginning plus 0.
Symbol extension-Converts a complement number to a larger data type.
Three, integer arithmetic
Unsigned number addition
An arithmetic operation overflow that indicates that a complete integer result cannot be placed into the word length limit of the data type.
Multiply Constants either unsigned or complement operations, multiplying by a power of 2 results in overflow.
Four, floating point number
When a number cannot be accurately represented in this format, it must be adjusted upwards or downwards
Binary decimals
The first step is to consider a binary number that contains a decimal value.
IEEE Floating point representation
Symbol Mantissa Order Code
Three cases: Normalized value non-planned value special value
Rounding
Floating point Arithmetic
Sentiment Summary: Through the study of the actual representation of numbers, understanding can be expressed in the range of merit and the properties of different arithmetic operations. Understanding these properties gives me a deeper understanding of the ability to write programs to work correctly within the full range of values and to have portability that spans different machines, operating systems, and compiler combinations. The security flaws of a large number of computers are caused by hesitation in the subtle details of computer arithmetic operations and need to be further understood.
Information Security System Design Foundation 4th Week Study Summary