diff options
author | Jack Sangdahl <[email protected]> | 2024-04-01 14:00:27 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2024-04-01 14:00:27 -0600 |
commit | 6fb34179efc44a8d3d39cfa7a514ecaaed83e9f8 (patch) | |
tree | f4712db984d79223630c4d9bd15a2a29a4d4ea38 /util.c | |
download | synacor_challenge-6fb34179efc44a8d3d39cfa7a514ecaaed83e9f8.tar.gz synacor_challenge-6fb34179efc44a8d3d39cfa7a514ecaaed83e9f8.zip |
initial
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -0,0 +1,37 @@ +// synacor challenge (@waffle87) +#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 |