Question: #include struct packed _ st { uint 8 _ t u _ byte; int 8 _ t s _ byte; uint 3 2 _ t

#include
struct packed_st {
uint8_t u_byte;
int8_t s_byte;
uint32_t u_int;
int32_t s_int;
int64_t s_double;
};
void unstruct_c(struct packed_st *packed_p, int64_t unpacked[]){
unpacked[0]=(int64_t) packed_p->u_byte;
unpacked[1]=(int64_t) packed_p->s_byte;
unpacked[2]=(int64_t) packed_p->u_int;
unpacked[3]=(int64_t) packed_p->s_int;
unpacked[4]=(int64_t) packed_p->s_double;
}
Need help with a riscv implementation of this code to produce the following:
$ ./unstruct 12345
C:
1(0x1)
2(0x2)
3(0x3)
4(0x4)
5(0x5)
Asm:
1(0x1)
2(0x2)
3(0x3)
4(0x4)
5(0x5)
$ ./unstruct 99-9999-99-99
C:
99(0x63)
-99(0xFFFFFFFFFFFFFF9D)
99(0x63)
-99(0xFFFFFFFFFFFFFF9D)
-99(0xFFFFFFFFFFFFFF9D)
Asm:
99(0x63)
-99(0xFFFFFFFFFFFFFF9D)
99(0x63)
-99(0xFFFFFFFFFFFFFF9D)
-99(0xFFFFFFFFFFFFFF9D)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!