finished task 0

This commit is contained in:
Rushil Umaretiya 2024-04-10 19:04:36 -04:00
parent 58eae3479f
commit 5d5a4b3d4d
No known key found for this signature in database
GPG Key ID: 4E8FAF9C926AF959

View File

@ -16,8 +16,11 @@ unsigned int addr_bits;
int number_of_blocks(unsigned int addr_bits,
unsigned int num_block_offset_bits) {
// TODO: Part 0
return 0;
if (addr_bits < num_block_offset_bits || num_block_offset_bits < 0 || addr_bits < 0)
return FAIL;
return addr_bits / exp2(num_block_offset_bits);
}
int read_memory_file(char* file_name) {