当前位置:网站首页>[CSAPP] Application of bit vectors | encoding and byte ordering
[CSAPP] Application of bit vectors | encoding and byte ordering
2022-07-27 05:19:00 【Lemon leaf C】

One w-bit The vector can be expressed as
. use 8-bit The binary code represents each given two unsigned integers , That's one 8-bit Vector , Then calculate the intersection of these two sets 、 Union and symmetric difference . The elements of this set are
. Each element corresponds in ascending order starting from the position on the left .
a) Let
28 =
00011110 is
Let
64 =
01000000 is
Then, translated by bit vector, we can get
![]()
,so that
(intersection)
(union)
(symmetric difference)
b) Same Way, Let
63 =
00111111 is
Let
112 =
01110000 is
Then,
![]()
,so that
(intersection)
(union)
(symmetric difference)

Hypothetical variables x and y The types of are int and short.x The address for 0x100,y The address for 0x200.x Four bytes of will be stored in memory location 0x100、0x101、0x102 and 0x103 It's about .y Two bytes of will be stored in memory location 0x200 and 0x201 It's about .x The value of is 27066166,y The value of is 41797. If we were to x and y Stored in the small end and the large end respectively , So what values are stored in a given memory range ?( In hexadecimal notation ).
= 27066166,
= 19C FF 36
= 41797,
= A3 45
Little endian:36 FF 9C 01 ... 45 A3
Big endian : 01 9C FF 36 ... A3 45

a)
1. The preprocessor modifies the original C program according to directives that begin with the # character, and deletes the comments. The result is another C program with the .i suffix.
2. The compiler translates the text file hello.i into the text file hello.s, which contains an assembly-language program. Each statement in an assembly-language program exactly describes one low-level machine-language instruction.
3. The assembler translates hello.s into machine-language instructions, packages them in a form known as a relocatable object program. The result is stored as object file hello.o.
4. A program can call a function resides in a separate precompiled object file. The linker handles this merging, and the executable object file hello is the final output.
b)
High-level programming languages and compilers provide an abstraction for application developers without the need to know internally complex machine-level code

a) Registers are a type of computer memory used to quickly accept, store, and transfer data and instructions that are being used immediately by the CPU.
b) The main memory is a temporary storage device that holds both a program and the data it manipulates while the processor is executing the program.
c) The L1 and L2 caches serve as temporary staging areas for information that the processor is likely to need in the near future. So, the processor can read data faster.

Convert the following decimal numbers into 8-bit Unsigned binary number and corresponding hexadecimal number , If unable to convert , Write it down as X.
a) 0 b) 255 c) 256 d) 100
a) 00000000, 00
b) 255 =
, 11111111 , FF
c) 256 =
, X
d) 100 =
, 01100100 , 64

A given 32 Bit binary code represents string or integer ( Use binary complement ). If the hexadecimal representation of each byte is in the following conversion table , The given code is a string ; Otherwise, it is an integer . Write down the string or integer of each binary code .( From left to right ) Example .
a) 45 53 4E 47, ESNG
b) 74 21 33 2e, t!3.
c) FF FF FF D4, -44
d) 00 01 57 A6, 87974

a) 211 + 240 = 451,384 + 247 = 631
,
b)for unsigned integer representation,
,
two's complement encoding integer representation,
,







边栏推荐
- Invert a Binary Tree
- Why is count (*) slow
- I've heard the most self disciplined sentence: those I can't say are silent
- TypeScript 详解
- [acwing] solution to the 61st weekly match
- Basic operation of vim
- Dialog data transfer
- 精选用户故事|洞态在聚水潭的误报率几乎为0,如何做到?
- A math problem cost the chip giant $500million
- Sunyanfang, co-founder of WeiMiao: take compliance as the first essence and become the "regular army" of financial and business education
猜你喜欢
![[acwing] solution to the 61st weekly match](/img/31/765f4ce9f779e8093668e7606e0198.png)
[acwing] solution to the 61st weekly match

Transaction database and its four characteristics, principle, isolation level, dirty read, unreal read, non repeatable read?

JVM上篇:内存与垃圾回收篇十四--垃圾回收器

辗转相除法

TypeScript 详解

《Robust and Precise Vehicle Localization based on Multi-sensor Fusionin Diverse City Scenes》翻译

How to sinicize the JMeter interface?

老子云携手福昕鲲鹏,首次实现3D OFD三维版式文档的重大突破

Acticiti中startProcessInstanceByKey方法在variable表中的如何存储

1、 MySQL Foundation
随机推荐
How idea creates a groovy project (explain in detail with pictures and texts)
JVM上篇:内存与垃圾回收篇五--运行时数据区-虚拟机栈
JVM Part 1: memory and garbage collection part 7 -- runtime data area heap
【无标题】按照一定的条件,对 i 进行循环累加。条件通常为循环数组的长度,当超过长度就停止循环。因为对象无法判断长度,所以通常搭配 Object.keys() 使用。\nforEach 一般认为是 普
树莓派rtmp推流本地摄像头图像
Counting Nodes in a Binary Search Tree
Scientific Computing Library - numpy
Use of file i/o in C
Translation of robot and precise vehicle localization based on multi sensor fusion in diverse city scenes
Invert a Binary Tree
Standard dialog qmessagebox
A math problem cost the chip giant $500million
B1023 组个最小数
Install pyGame
支付流程如何测试?
Basic operation of vim
JVM上篇:内存与垃圾回收篇二--类加载子系统
TypeScript 详解
Raspberry pie RTMP streaming local camera image
JVM Part 1: memory and garbage collection part 6 -- runtime data area local method & local method stack
28 =
00011110 is 

,so that
(intersection)
(union)
(symmetric difference)
(intersection)
(union)
(symmetric difference)
= 27066166,
= 19C FF 36
= 41797,
= A3 45
, 11111111 , FF
, X
, 01100100 , 64
,
,
,