首页 > TAG信息列表 > DataLab

【DIY】【CSAPP-LAB】深入理解计算机系统--datalab笔记

前言 《深入理解计算机系统》一书是计算机系统入门的极好选择,从其第三版的豆瓣评分 9.8分 可见一斑。该书的起源是卡耐基梅龙大学 计算机系统入门课【Introduction to Computer System】的讲义,与其配套的还有发布在其官网上的实验,这也正是【CSAPP-LAB】这个系列所要【DIY】的。 这

CSAPP 之 DataLab 详解

前言 本篇博客将会剖析 CSAPP - DataLab 各个习题的解题过程,加深对 int、unsigned、float 这几种数据类型的计算机表示方式的理解。 DataLab 中包含下表所示的 12 个习题,其中 9 个和整数有关,3个和单精度浮点数有关。 函数名 功能描述 分数 操作符 bitXor(x, y) 使用 & 和 ~

CSAPP lab1 datalab

#bitXor 用位运算模拟异或运算,这里用到了摩根定律: int bitXor(int x, int y) { // x^y = (~x&y) | (x~&y) = ~(~(~x&y) & ~(x&~y)) return ~(~(~x & y) & ~(x & ~y)); } #tmin 有符号整型数表示的最小数的位模式中,最高位是1,其余位全为0 int tmin(void) { return 1 << 31;

【CSAPP】 datalab 详解

位运算还能这样玩,我是万万没想到的。 bitXor /* * bitXor - x^y using only ~ and & * Example: bitXor(4, 5) = 1 * Legal ops: ~ & * Max ops: 14 * Rating: 1 */ 意思就是说我们用 ~ 和 & 实现 ^ 。 // x ^ y = x & (~y) | (~x) & y // ~ (x | y) = ~x & ~y //

DataLab题解

CS:APP DataLab题解 Lab简述 ​ 使用高度受限的C语言子集实现简单的逻辑、二进制补码和浮点数操作的函数。 Notes 使用dlc compiler来检测你的代码是否符合规范 每个函数使用的运算符数量会有一定的限制,不得超出该限制(=不计入统计),限制数在题目前的注释内给出 使用btest验证你

CSAPP datalab

/* * CS:APP Data Lab * * Cervoliu HIT * * bits.c - Source file with your solutions to the Lab. * This is the file you will hand in to your instructor. * * WARNING: Do not include the <stdio.h> header; it confuses the dlc * comp

深入理解计算机原理(csapp第三版)——datalab

代码:https://gitee.com/iwehdio/csapp-lab 1. bitXor bitXor - x^y using only ~ and & Example: bitXor(4, 5) = 1 Legal ops: ~ & Max ops: 14 Rating: 1 异或,只能用~和&,操作数最大14个 int bitXor(int x, int y) { int res = ~(~(x & ~y) & ~(~x & y));

【CSAPP】 lab1 datalab

1.实验详解 1.1 bitXor /* * bitXor - x^y using only ~ and & * Example: bitXor(4, 5) = 1 * Legal ops: ~ & * Max ops: 14 * Rating: 1 */ int bitXor(int x, int y) { return ~(~x&~y)&~(x&y); } 思路 异或运算的逻辑表达式是 对应的是 return (x&

CSAPP_DataLab

Data Lab //难度4 logicalNeg - implement the ! operator, using all of the legal operators except ! Examples: logicalNeg(3) = 0, logicalNeg(0) = 1 Legal ops: ~ & ^ | + << >> Max ops: 12 Rating: 4 //实现逻辑非,限制操作:~ & ^ | + << >>

csapp---datalab 总结

1.引言:   很早就耳闻csapp的大名,这学期刚好学到计组,就连顺着拜读了一下经典的csapp。不得不说,刚读完第二章就不由得感慨,不愧是神书。   自我感觉,学校学的计组主要侧重于硬件方面,太过于底层,而csapp则是从代码的角度来解释底层的运转,不需要掌握什么三态门、什么选择器等等,

CSAPP:datalab

CSAPP:datalab 代码中有具体思路的标注。 /* * CS:APP Data Lab * * * bits.c - Source file with your solutions to the Lab. * This is the file you will hand in to your instructor. * * WARNING: Do not include the <stdio.h> header; it confus

CSAPP: Datalab

一、实验要求 实现如下几个问题: 对于int的问题,只能使用基本的位运算,对于float的,可是使用额外的控制语句。 二、预备知识 整型的表示方法: 无符号数: 有符号数: 无符号数和有符号数直接相互转换: 浮点数表示方法: 一般浮点数采用IEEE 754标准表示 V=。 S为符号位,占1bit。 E

CSAPP-datalab

经典重温,冲冲冲。 Integer bitXor /* * bitXor - x^y using only ~ and & * Example: bitXor(4, 5) = 1 * Legal ops: ~ & * Max ops: 14 * Rating: 1 */ int bitXor(int x, int y) { return ~(~(~x & y) & ~(~y & x)); } 解题思路:布尔代数。对于异或,从定义式