CS代考 Exam 1, Version 1 (day listed as “Thursday”)

Exam 1, Version 1 (day listed as “Thursday”)
15-213/18-243 Fall 2009

Copyright By PowCoder代写 加微信 powcoder

True (!ux is a signed int)

aaaaaaaaaxb1b2b3
ccccdxxxeeeexxxx
ffffffffggxxxxxx<-end ffffffffcccceeee b1b2b3ggaaaaaaaa adxxxxxx<-end Format A Format B Bits Value Bits Value 0111 0000 1 011111 00 1 1101 1100 112 100101 11 112 0110 0111 23/32 011110 10 24/32 1111 0000 inf 110111 10 3*2^23 0000 0101 5/1024 010111 01 5/1024 int foo (unsigned int a) int b = 0; switch (a + 1) { b = a >> 1;
__________;
b = b ^ a;
break; // optional break (falls through either way)

4. a == -1 => Tmin
a == 0 => 6
a == 1 => -5
a == 2 => 0
a == 3 => 6
o.w. => 5

a) ecx = rax + r8
b) eax = *(rdi + rax) // rdi is int *
eax = *(rdi + 4 * rax) // rdi is char *
c) no stack to return from, no push %ebp
32-bit has les registers than 64-bit mode, so local variables
would need to be stored on the stack. Stack accessing takes
extra instructions and extra time.
int mystery (int * array, size_t size, int e){
int max = size;
int min = 0;
while (max – min > 0) {
a = (max – min) / 2 + 1;
if (array[a] < e) { } else if (array[a] < e) { return -1; f) Binary Search 程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com