Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please convert the following C code into Mars MIPS code: if (j < 0x80) { // j fits in 7 bits, expand to 8 bits
Please convert the following C code into Mars MIPS code:
if (j < 0x80) {
// j fits in 7 bits, expand to 8 bits // n = j
} else if (j <= 0x7FF) {
// j fits in 11 bits, expand to 16 bits // b = low 6 bits of j // a = next 5 bits of j // n = 110 a 10 b // 5 6 bits in
// j = aaaaa bbbbbb
// 3 5 2 6 bits out
// n = 110 aaaaa 10 bbbbbb
} else if (j <= 0xFFFF) {
// j fits in 16 bits, expand to 24 bits // c = low 6 bits of j // b = next 6 bits of j // a = next 4 bits of j
// n = 1110 a 10 b 10 c
// 4 6 6 bits in
// j = aaaa bbbbbb cccccc
// 4 4 2 6 2 6 bits out
// n = 1110 aaaa 10 bbbbbb 10 cccccc
// 4 4 2 6 2 6 bits out
// n = 1110 aaaa 10 bbbbbb 10 cccccc
} else if (j <= 0x10FFFF) { // j fits in 21 bits, expand to 32 bits // d = low 6 bits of j // c = next 6 bits of j // b = next 6 bits of j // a = next 3 bits of j // n = 11110 a 10 b 10 c 10 d
// 3 6 6 6 bits in
// j = aaa bbbbbb cccccc dddddd
// 5 3 2 6 2 6 2 6 bits out // n = 11110 aaa 10 bbbbbb 10 cccccc 10 dddddd
} else {
// j is outside the UTF-8 range of character codes // n = 0xFFFFFFFF
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started