首页 > 其他分享 >《Programming from the Ground Up》阅读笔记:p95-p102

《Programming from the Ground Up》阅读笔记:p95-p102

时间:2024-08-24 10:03:47浏览次数:5  
标签:word bytes rept Programming p95 Up write byte bit

《Programming from the Ground Up》学习第6天,p95-p102总结,总计8页。

一、技术总结

1.directive(伪指令)

很多资料喜欢把directive和instruction都翻译成“指令”,这样在看到指令这个词时就不知道到底指的是什么?这里参考其它人的做法,将directive称为“伪指令”。

2.rept & .endr

语法:

.rept count

...

.endr

(1).rept: rept是"repeat"的缩写,表示.rept和.endr之间的内容重复count次。

(2).endr: endr是“end repeat”的缩写。

record2:
 .ascii "Marilyn\0"
 .rept 32 #Padding to 40 bytes
 .byte 0
 .endr

如上所示,"Marilyn\0"长度是8,占8个bytes, 重复0 byte 32次,所以是“Padding to 40 bytes”。

3.bit、byte、word

(1)bit

bit就是0或者1,即0是一个bit,1也是一个bit。01是两个bit,00000000是八个bit。

(2)byte

1 byte = 8 bit。

(3)word

word由多少个byte构成取决于电脑是多少位的:

16-bit architecture: A word is 2 bytes (16 bits).

32-bit architecture: A word is 4 bytes (32 bits).

64-bit architecture: A word is 8 bytes (64 bits).

(4)示例

《programming from the ground up》:p96, In this, everything is character data except for the age, which is simply a numeric field, using a standard 4-byte word(we could just use a single byte for this, but keeping it at word makes it easier to process)。

二、英语总结

1.open back up

p95, You can shut down the program and open it back up, and you are back where you started.

在上面这句话中“open it back up”的意思是“re-open, open again”。

2.be off with

p95, Structured data can contain variable-length fields, but at that point you are usually better off with a database.

在这句话话中“be better off with database”翻译过是“最好使用数据库”。

3.have sth down vs have sth down pat

have sth down的意思是“know it”,have sth down pat的意思是“know it perfectly”。示例:

p100,Now that we have our basic definitions down, we are ready to write oure programs.

三、其它

《Progromming From The Ground Up》p104写着:as write-record.s -o write-record.o,但前面都没有提到哪里定义了write-record.s这个文件,整本书翻遍了都没有找到。此时转到Github上去找,发现了别人写的write-record.s文件。

书上没有写哪段代码是写在这个文档,为什么别人知道呢?个人猜测是看到了as write-record.s -o write-record.o 这句命令,知道放到这里。这种灵活转换是我目前需要学习的。根据已有的条件去实现目标,不纠结于问题或错误。

四、参考资料

1. 编程

(1)Jonathan Bartlett,《Programming From The Ground Up》:https://book.douban.com/subject/1787855/

2. 英语

(1)Etymology Dictionary:https://www.etymonline.com

(2) Cambridge Dictionary:https://dictionary.cambridge.org

欢迎搜索及关注:编程人(a_codists)

标签:word,bytes,rept,Programming,p95,Up,write,byte,bit
From: https://www.cnblogs.com/codists/p/18377445

相关文章

  • vue3 语法糖<script setup>
    在Vue3中,<scriptsetup>是一种新的语法糖,它极大地简化了组件的编写方式。<scriptsetup>是在单文件组件(SFC)中使用组合式API的编译时语法糖。当同时使用SFC与组合式API时该语法是默认推荐。基本概念简洁的语法:<scriptsetup>允许在<script>标签中直接使用组......
  • WPF ystem.Windows.Markup.XamlParseException HResult=0x80131501 Message='Spec
    System.Windows.Markup.XamlParseExceptionHResult=0x80131501Message='Specifiedclassname'WpfApp268.MainWindow'doesn'tmatchactualrootinstancetype'System.Windows.Window'.RemovetheClassdirectiveorprovideanin......
  • el-upload重复上传文件失效(Element-Plus)
    当指定了参数limit=1,再次上传就会无效以下是官方文档给出的解决方法示例通过on-exceed来定义超出限制时的行为<template><el-uploadref="uploadRef":limit="1":on-exceed="handleExceed":auto-upload="false"></el-upload>......
  • P10528 [XJTUPC2024] 崩坏:星穹铁道 题解
    求方案数,分多种情况,不难想到DP。设\(dp_{i,j}\)表示已经行动\(i\)次,剩余战技点个数为\(j\)的方案数,容易得到以下转移方程。\(a_i=1\)时,有\[dp_{i,j}=\begin{cases}0,&j=0,\\dp_{i-1,j-1},&1\leqslantj\leqslant4,\\dp_{i-1,j-1}+dp_{i......
  • SuperCLUE整理
    参考信息:git:https://github.com/CLUEbenchmark/SuperCLUE官网:https://www.cluebenchmarks.com/superclue.html23年7月论文:https://arxiv.org/pdf/2307.15020:24年4月报告:https://www.cluebenchmarks.com/superclue_240424年7月报告:https://www.cluebenchmarks.com/superclu......
  • P9145 [THUPC 2023 初赛] 世界杯
    [题目通道]([THUPC2023初赛]世界杯-洛谷)简要题意:输出五常中的最强球队。众所周知,每个国家的球队都有自己的长处,在不同规则下最强球队也有所不同。而小M制定的规则是输球场数最少,这是有道理的,因为输球场数可以评判一个球队的稳定性。输球场数越少,就说明稳定性越强,实力......
  • 本地环境注入jupyter:无法在jupyter选择已经创建的conda环境?快来看下解决办法(jupyter n
    1、Win+R打开本机cmd命令行2、运行condaactivate本地已创建的环境名称3、运行condainstallipykernel4、运行python-mipykernelinstall--user--name本地环境名称--display-name"在jupyter上显示的环境名称"就可以在jupyternotebook中看到环境,并进行选择使用......
  • Xtrabackup全备恢复部分数据库
    背景:生产环境数据采用xtrabackup全量备份数据库,在某些场景下需要进行单个数据库恢复。以下为模拟测试用例:创建测试用表:[root@localhost][(none)]>showdatabases;+--------------------+|Database|+--------------------+|information_schema||mysql......
  • 详细讲述 Vue3 的 <script setup>
    <scriptsetup>是Vue3引入的一种新的 <script> 标记的用法,其本质是一个语法糖。它极大简化了单文件组件(SFC)的开发体验,目的是让代码更简洁、易读,同时减少模板和逻辑之间的重复。1.基本用法<!--使用<scriptsetup>--><template><div><p>message:{{message......
  • 高性能无锁队列 Disruptor 核心原理分析及其在i主题业务中的应用
    小结:生产者生产数据时,需要入队。消费者消费数据时,需要出队。入队时,不能覆盖没有消费的元素。出队时,不能读取没有写入的元素。因此,Disruptor中需要维护一个入队索引(生产者数据生产到哪里,对应AbstractSequencer中的cursor)和一个出队索引(所有消费者中消费进度最小的序号)。 ......