
首页

归档

关于
CSAPP Data Lab

CSAPP Data Lab

文章目录

z0z0r4
z0z0r4
文章
11
分类
13
标签
11

首页

归档

关于
2026-02-25 2026-03-05
study-notesCSCSAPP

2026-02-25 到 2026-02-28 完成 😐


材料下载

其中有一些工具:

btest 可以用来测试,btest -f func_name 可以测试指定函数,-1 value1 -2 value2 - 3 value3 可以指定测试参数

dlc -e bits.c 可以纠正风格和统计操作符数量

ishow 和 fshow 可以分别显示 int 和 float 的相关信息,比如

1
2
❯ ./ishow 127
Hex = 0x0000007f, Signed = 127, Unsigned = 127
1
2
3
4
5
❯ ./fshow 3.75

Floating point value 3.75
Bit Representation 0x40700000, sign = 0, exponent = 0x80, fraction = 0x700000
Normalized. +1.8750000000 X 2^(1)

具体见 ishow -h 和 fshow -h

driver.pl 用来评分


确实得写Lab,我一开始只想看书,但试了下发现不实践不会遇到很多诡异的需求…

好几个问题都无从下手,奇怪的技巧,被迫借鉴思路…相比只下 Rating 4 的两个 float 显得简单很多。

实现太丑陋了,在写完全部 Lab 之前不公开 =_=

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
❯ ./driver.pl
1. Running './dlc -z' to identify coding rules violations.

2. Compiling and running './btest -g' to determine correctness score.
gcc -O -Wall -m32 -lm -o btest bits.c btest.c decl.c tests.c

3. Running './dlc -Z' to identify operator count violations.

4. Compiling and running './btest -g -r 2' to determine performance score.
gcc -O -Wall -m32 -lm -o btest bits.c btest.c decl.c tests.c

5. Running './dlc -e' to get operator count of each function.

Correctness Results Perf Results
Points Rating Errors Points Ops Puzzle
1 1 0 2 7 bitXor
1 1 0 2 1 tmin
1 1 0 2 7 isTmax
2 2 0 2 7 allOddBits
2 2 0 2 2 negate
3 3 0 2 12 isAsciiDigit
3 3 0 2 8 conditional
3 3 0 2 20 isLessOrEqual
4 4 0 2 5 logicalNeg
4 4 0 2 49 howManyBits
4 4 0 2 18 floatScale2
4 4 0 2 19 floatFloat2Int
4 4 0 2 8 floatPower2

Score = 62/62 [36/36 Corr + 26/26 Perf] (163 total operators)
  • CSAPP
  • study-notes
CSAPP Bomb Lab
前一篇

CSAPP Bomb Lab

Plan and Check-in
后一篇

Plan and Check-in

Creative Commons License All website licensed under CC BY 4.0
2025-2026 z0z0r4
基于 Hexo  Theme.Reimu
50.3k  |  04:00
粤ICP备2025511811号
粤公网安备44130302100361号
总访问量   |  总访客量 

文章目录

z0z0r4
z0z0r4
文章
11
分类
13
标签
11

首页

归档

关于