aboutsummaryrefslogtreecommitdiff
path: root/util.c
blob: fc3648d2b5a3275f299f633a9ebef2a66e244715 (plain)
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
// synacor challenge ([email protected])
#include "util.h"

#ifndef NDEBUG
char *reg_string(unsigned short r) {
  static char str[6];
  switch (r) {
  case 32768:
    sprintf(str, "r0");
    break;
  case 32769:
    sprintf(str, "r1");
    break;
  case 32770:
    sprintf(str, "r2");
    break;
  case 32771:
    sprintf(str, "r3");
    break;
  case 32772:
    sprintf(str, "r4");
    break;
  case 32773:
    sprintf(str, "r5");
    break;
  case 32774:
    sprintf(str, "r6");
    break;
  case 32775:
    sprintf(str, "r7");
    break;
  default:
    sprintf(str, "null");
  }
  return str;
}
#endif // NDEBUG