讲解:Winter 18 CIS 314、R、R、R、R、R

Winter ’18 CIS 314 Midterm A Name: SID: 1. [5] What is the decimal value of the byte 0x38, interpreted as an 8-bit unsigned int? Show your work: 2. [5] What is the decimal value the of byte 0x38, interpreted as an 8-bit (signed) int? Show your work: 3. [5] What is the decimal value of the byte 0x83, interpreted as an 8-bit (signed) int? Show your work: 4. [10] What is the hex value of x >> 4, assuming x is a 32-bit (signed) int with hex value 0x83838383? Show your work: 5. [15] What is the decimal value of 0xC1540000, interpreted as an IEEE-754 signle-precision float? Show your work: 6. [15] Consider the follow C function: int isNegativeZero(float f); Implement the above function such that it will return 1 if f == -0.0f, 0 otherwise. Do this using only bitwise operators (ands, ors, shifts) and integer equality (==); no floating-point operations, if statements, or loops. Hint: access the bit representation of f by casting its address to an unsigned-int pointer (similar t代写留学生Winter 18 CIS 314课程设计、R编程代写、帮做R编程作业、R语言代做留学生、调试R作业、R作业调o assignment 2), then test the value at this pointer against the expected IEEE-754 bit representation for -0.0 as hex. Comment your code: 7. [20] Consider the following IA32 code, resulting from compiling a function int f(int x, int y): pushl %ebp movl %esp, %ebp movl 8(%ebp), %eax movl 12(%ebp), %ecx leal 10(%ecx,%eax,8), %eax popl %ebp retl a. (15) Convert the above code to C. Comment your code: b. (5) What is returned by f(1, 2)? Show your work: 8. [25] Consider the following C code: int popCount(unsigned int x) { int result = 0; do { result += x 0x1; x >>= 1; } while (x); return resu} a. (10) The above code counts the number of 1s in the bit representation of x. Rewrite the code (in C) to use a label and goto statement rather than a loop. Comment your code: b. (15) Convert your C code from part A above into IA32, ensuring that register use is correct with respect to the IA32 register conventions. Comment your code: 转自:http://ass.3daixie.com/2018110120083443.html

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • pyspark.sql模块 模块上下文 Spark SQL和DataFrames的重要类: pyspark.sql...
    mpro阅读 9,835评论 0 13
  • 函数调用 Built-in Functions abs(x) Return the absolute value ...
    叫我七夜阅读 1,297评论 0 0
  • 周小军看着她走远的背影的眼神是绝望的。 爱一个人那么久,用尽了毕生精力一步步迈向那个最心爱的姑娘。眼看着自己成功了...
    不过呢阅读 560评论 0 4
  • 绿柳照春水, 乱花飞蝶影。 春风香十里, 芳菲自在心。
    东珊明月阅读 268评论 0 1
  • 1、句子扩写:站在大楼顶上,他想跳下去 站在公司空旷的楼顶,楼下车来车往,人流不息,望着手机中50多个未接电话,全...
    蓝光一阅读 679评论 0 0

友情链接更多精彩内容