-
Notifications
You must be signed in to change notification settings - Fork 0
/
regDecode.c
53 lines (50 loc) · 817 Bytes
/
regDecode.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "regDecode.h"
char* decodeReg(char* reg,int n){
if(reg[1] == '0'){
if(n == 0){
return "00";
}
else if(n == 1){
return "00000000000";
}
else if(n == 2){
return "000000000";
}
}
if(reg[1] == '1'){
if(n == 0){
return "01";
}
else if(n == 1){
return "00000000001";
}
else if(n == 2){
return "000000001";
}
}
if(reg[1] == '2'){
if(n == 0){
return "10";
}
else if(n == 1){
return "00000000010";
}
else if(n == 2){
return "000000010";
}
}
if(reg[1] == '3'){
if(n == 0){
return "11";
}
else if(n == 1){
return "00000000011";
}
else if(n == 2){
return "000000011";
}
}
}