Lab 2 is up

122 views
Skip to first unread message

Arrvindh Shriraman

unread,
Sep 11, 2020, 12:31:44 PM9/11/20
to cmpt-295-sfu
Lab 2 is up
- it does not include a prof vid.
- please go over the handouts and pptx.
- respond to this message with your questions and they will be answered on Wednesday (only questions added to this thread will be answered).
- We expect questions to use the coding template on welcome message of the groups.
- feel free to clone and take a look at the code, but we may update some parts between now and Wednesday.
- No! you do not need to submit and push anything


Arrvindh Shriraman

unread,
Sep 17, 2020, 11:43:00 AM9/17/20
to cmpt-295-sfu
If you wish me to discuss any of the lab 2 solutions in class, please reply here

Trevor Bonas

unread,
Sep 17, 2020, 6:13:47 PM9/17/20
to cmpt-295-sfu
I have questions regarding withinSameBlock and withinArray.

For withinSameBlock: we want to find out whether two addresses are within the same 64-byte-aligned block of memory. It says 2^6 = 64, that being 64 possible combinations of 1's and 0's for six bits: 64 possible addresses for the least significant end of a pointer's address alone. So it says we have to eliminate these last six bits and compare "the first 26 bits." It seems the addresses are assumed to be 32 bits long, 4 bytes for an int. My question is: why? What does excluding the last 6 bits give us?

For withinArray I just can't make sense of the explanation:

// ptr points to the ready-to-check element, intArray points to the first

// element of the array sign1 indicate the difference from the ready-to-check

// element to the first element sign2 indicate the difference from the last

// element to the ready-to-check element if either sign1 or sign2 is 1, the

// XOR will return 1, which indicate the two differences are difference and

// the ready-to-check is not within the array. The result should return 0,

// logic 'not' is required here. otherwise, the XOR will return 0, which

// indicate the two differences are the same and the ready-to-check is within

// the array. The result should reutrn 1, logic not is required here.

Arrvindh Shriraman

unread,
Sep 20, 2020, 8:33:25 PM9/20/20
to cmpt-295-sfu
Here is a video explaining it (the video is still processing, so maybe try in 30 minutes).
Reply all
Reply to author
Forward
0 new messages