datalab-handout实验

csapp深入了解计算机系统配套datalab-handout实验 修改bits.c的副本,使其通过所有在不违反任何编码准则的情况下在btest中进行测试。 (2)源程序清单或者主要伪代码; ①.bitAnd: 这个函数是将两个数x,y进行与运算。根据以前学的数电的知识,利用摩根定理,/(x&y)=x|y,再次求反可得结果 ②.getByte: 要得到X的第n个字节。只需要简单的把留的字节移到最右端,再与0xff相与即可 ③.logicalShift ... 阅读详情
这是计算机系统2的一个实验作业,花了半天多做完,感觉有几道题挺有趣的,也顺便做一下笔记,方便以后复习或工作时可以查看。
运行环境:ubuntu 16.04。
为了与实验语言一致,我用英文注释了。
/* 
 * CS:APP Data Lab 
 * 
 * <Please put your name and userid here>
 * 
 * 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
 * compiler. You can still use printf for debugging without including
 * <stdio.h>, although you might get a compiler warning. In general,
 * it's not good practice to ignore compiler warnings, but in this
 * case it's OK.  
 */

#if 0
/*
 * Instructions to Students:
 *
 * STEP 1: Read the following instructions carefully.
 */

You will provide your solution to the Data Lab by
editing the collection of functions in this source file.

INTEGER CODING RULES:

  Replace the "return" statement in each function with one
  or more lines of C code that implements the function. Your code 
  must conform to the following style:

  int Funct(arg1, arg2, ...) {
      /* brief description of how your implementation works */
      int var1 = Expr1;
      ...
      int varM = ExprM;

      varJ = ExprJ;
      ...
      varN = ExprN;
      return ExprR;
  }

  Each "Expr" is an expression using ONLY the following:
  1. Integer constants 0 through 255 (0xFF), inclusive. You are
      not allowed to use big constants such as 0xffffffff.
  2. Function arguments and local variables (no global variables).
  3. Unary integer operations ! ~
  4. Binary integer operations & ^ | + << >>

  Some of the problems restrict the set of allowed operators even further.
  Each "Expr" may consist of multiple operators. You are not restricted to
  one operator per line.

  You are expressly forbidden to:
  1. Use any control constructs such as if, do, while, for, switch, etc.
  2. Define or use any macros.
  3. Define any additional functions in this file.
  4. Call any functions.
  5. Use any other operations, such as &&, ||, -, or ?:
  6. Use any form of casting.
  7. Use any data type other than int.  This implies that you
     cannot use arrays, structs, or unions.


  You may assume that your machine:
  1. Uses 2s complement, 32-bit representations of integers.
  2. Performs right shifts arithmetically.
  3. Has unpredictable behavior when shifting an integer by more
     than the word size.

EXAMPLES OF ACCEPTABLE CODING STYLE:
  /*
   * pow2plus1 - returns 
linux按位运算datalab-handout 进入bits.c ,根据bits.c中的具体要求补全以下13个函数: •intbitXor(intx, int y); •inttmin(void); •intisTmax(intx); •ntallOddBits(intx); •intnegate(int x); •intisAsciiDigit(intx); •intconditional(int x, inty, int z) 阅读详情

相关推荐

datalab handout

cmu datalab handout,ics课程的原版提交文件

datalab-handout完成版

datalab-handout完成版,bits.c包含完成课程作业所需要的代码,并且其中备注了实验完成过程中的所有注释

datalab-handout.tar

计算机学习

csapp data lab 满分原创(北大&cmu;) 仅供参考,请勿抄袭

csapp data lab 2016年版本 满分原创(北大&cmu;) 仅供参考,请勿抄袭

slp-week02-datalab_slp_

bits.c practice for System Level Programming

华为昇腾Atlas200DK. CANN模型推理——目标检测结果不对(无检测结果)的问题解决

目录前言问题描述问题排查1.后处理模块问题排查2.预处理模块问题排查3.模型问题排查4.算法bug问题排查5.AI板卡问题排查6.模型精度问题排查6.模型推理问题解决:模型输入数据与预处理不同后记 前言 上周我在华为昇腾Atlas200DK中部署nanodet和yolov5时,出现了目标检测结果不对(没有检测到任何物体),困扰了整整三天,最后找到原因并圆满解决,在这里记录一下debug过程。 以上测试均在python中完成。 问题描述 第一天上午,我首先将nanodet由pytorch的.pth模型转换为.

qq_41035283的博客 5604

黑暗中的爆破(船讯网Ais爬虫暨爬虫实战js逆向学习经验分享)

船讯网 爬虫 js逆向 python

returnadsss的博客 1576

Squareline Studio + LVGL实战:从Figma设计到MCU屏幕的UI开发一条龙(避坑中文显示)

本文详细介绍了使用Squareline Studio和LVGL实现从Figma设计到MCU屏幕UI开发的全流程,重点解决中文显示等常见问题。通过设计工具链搭建、设计稿转换、LVGL工程集成及性能优化等步骤,帮助开发者高效完成嵌入式GUI开发,提升开发效率。

weixin_29246195的博客 584

CentOS7安装openGauss5.0.2LTS版本

该文档要根据自己的实际情况调整ip地址。要根据自己的实际网卡调整。

superhanyubo的专栏 2579

小红书爬取实战指南

以上方案仅供技术学习参考,请确保遵守目标网站的服务条款和相关法律法规。

monk all the way 6927

Qt Installer Framework 简单使用

qt installer framework 简单使用

qq_42815643的博客 2576

车载软件架构 —— AUTOSAR Vector SIP包(三)

### 上一篇文章中介绍了AUTOSAR基础软件供应商Vector公司的开发工具链,本文将继续介绍Vector公司的AUTOSAR产品。 ### -> 1、Vector SIP包中的StartApplication ### -> 2、StartApplication如何开始使用

Soly_kun的博客 831

Python实现商品价格监控与波动分析爬虫项目

本文通过完整的代码示例和详细的技术讲解,展示了如何实现商品价格的自动监控和波动分析。该项目不仅适用于个人购物助手,还可以扩展为商家的竞品监控工具。通过结合数据抓取、存储、分析与可视化,能够帮助我们更好地理解市场趋势并做出优化决策。

2201_76125261的博客 1743

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

上一篇: 并行计算-openMP学习笔记(2)
下一篇: hdu4717-(The Moving Points)
blackturtle
博客等级 码龄10年 15粉丝 39原创
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值