#include <stdio.h>
#include <stdint.h>
uint32_t set_baud_rate(uint32_t reg, uint8_t baud) {
// Your code here
uint32_t mask = ~(0xF << 8); // mask with 0's on update bit positions
reg &= mask;
// print_binary(reg);
reg |= (baud)<<8;
// print_binary(reg);
return reg ;
}
int main() {
uint32_t reg;
uint8_t baud;
scanf("%u %hhu", ®, &baud);
printf("%u", set_baud_rate(reg, baud));
return 0;
}
Input
0 10
Expected Output
2560