




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第2章信息的表示与处理
——信息存储
计算机组成与结构
2016年4月主讲教师Today:Information
StorageRepresentationsinmemory,pointers,stringsByte-OrientedMemoryOrganizationProgramsrefertodatabyaddressConceptually,envisionitasaverylargearrayofbytesInreality,it’snot,butcanthinkofitthatwayAnaddressislikeanindexintothatarrayand,apointervariablestoresanaddressNote:systemprovidesprivateaddressspacestoeach“process”ThinkofaprocessasaprogrambeingexecutedSo,aprogramcanclobberitsowndata,butnotthatofothers•••00•••0FF•••FMachineWordsAnygivencomputerhasa“WordSize”Nominalsizeofinteger-valueddataandofaddressesMostcurrentmachinesuse32bits(4bytes)aswordsizeLimitsaddressesto4GB(232bytes)Becomingtoosmallformemory-intensiveapplicationsleadingtoemergenceofcomputerswith64-bitwordsizeMachinesstillsupportmultipledataformatsFractionsormultiplesofwordsizeAlwaysintegralnumberofbytesWord-OrientedMemoryOrganizationAddressesSpecifyByteLocationsAddressoffirstbyteinwordAddressesofsuccessivewordsdifferby4(32-bit)or8(64-bit)00000001000200030004000500060007000800090010001132-bitWordsBytesAddr.001200130014001564-bitWordsAddr=??Addr=??Addr=??Addr=??Addr=??Addr=??000000040008001200000008Forotherdatarepresentationstoo…CDataTypeTypical32-bitIntelIA32x86-64char111short222int444long448longlong888float444double888longdouble810/1210/16pointer448ByteOrderingSo,howarethebyteswithinamulti-bytewordorderedinmemory?ConventionsBigEndian:Sun,PPCMac,InternetLeastsignificantbytehashighestaddressLittleEndian:x86LeastsignificantbytehaslowestaddressByteOrderingExampleExampleVariablexhas4-bytevalueof0x01234567Addressgivenby&xis0x1000x1000x1010x1020x103012345670x1000x1010x1020x10367452301BigEndianLittleEndian0123456767452301RepresentingIntegersDecimal: 15213Binary:
0011101101101101Hex:
3B6D6D3B0000IA32,x86-643B6D0000SunintA=15213;93C4FFFFIA32,x86-64C493FFFFSunTwo’scomplementrepresentationintB=-15213;longintC=15213;000000006D3B0000x86-643B6D0000Sun6D3B0000IA32ExaminingDataRepresentationsCodetoPrintByteRepresentationofDataCastingpointertounsignedchar*allowstreatmentasabytearrayPrintfdirectives:%p: Printpointer%x: PrintHexadecimaltypedefunsignedchar*pointer;voidshow_bytes(pointerstart,intlen){inti;for(i=0;i<len;i++)printf(”%p\t0x%.2x\n",start+i,start[i]);printf("\n");}show_bytesExecutionExampleinta=15213;printf("inta=15213;\n");show_bytes((pointer)&a,sizeof(int));Result(Linux):inta=15213;0x11ffffcb8 0x6d0x11ffffcb9 0x3b0x11ffffcba 0x000x11ffffcbb 0x00RepresentingPointersDifferentcompilers&machinesassigndifferentlocationstoobjectsintB=-15213;int*P=&B;x86-64SunIA32EFFFFB2CD4F8FFBF0C89ECFFFF7F0000charS[6]="18243";RepresentingStringsStringsinCRepresentedbyarrayofcharactersEachcharacterencodedinASCIIformatStandard7-bitencodingofcharactersetCharacter“0”hascode0x30
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年中学教学服务合同范文概述
- 2025年中等职业教育资助合同标准版
- 2025年亚马逊货代业务合作合同范例
- 2025年公务车辆维修与保养服务合同
- 2025年企业间产品营销合作合同模板
- 2025年保密协议合同标准文本
- 渔业信息化建设-第1篇-深度研究
- 新型城镇化发展路径-深度研究
- 2025年制造业设备更新喷涂服务合同
- 水资源生态修复策略-深度研究
- 2024并网光伏逆变器技术规范
- 文言文多文本阅读:叔向见韩宣子(附答案解析与译文)
- 工程招投标模拟实训报告范文2024年
- 系统脱敏治疗的长期疗效跟踪评估
- DB13(J)T 8406-2021 装配式混凝土结构工程施工与质量验收规程(京津冀)
- 浙江省台州市2024年中考语文模拟试题及答案6
- 离婚被告辩护词格式范文
- 2024数字化风电场智慧运营
- 机电一体化综合应用教程 课件 项目二 加盖拧盖单元的安装与调试
- 大学生创新创业基础教程(高校创新创业教育课程)全套教学课件
- 2024年江苏农林职业技术学院单招职业适应性测试题库完美版
评论
0/150
提交评论