From 33cfec88938f59fca3c7f4ebb89d2d9bb361280d Mon Sep 17 00:00:00 2001 From: Val Date: Fri, 2 Sep 2022 06:22:18 -0500 Subject: [PATCH] Update function signatures and stuff --- 17-Chernobyl/Code/inc/chernobyl.h | 4 ++-- 17-Chernobyl/Code/src/chernobyl.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/17-Chernobyl/Code/inc/chernobyl.h b/17-Chernobyl/Code/inc/chernobyl.h index b69a10f..657789a 100644 --- a/17-Chernobyl/Code/inc/chernobyl.h +++ b/17-Chernobyl/Code/inc/chernobyl.h @@ -4,10 +4,10 @@ #include "chernobyl_types.h" u16 _main (); -u16 walk (u16 r15); +u16 walk (u16 r15); // unused u16 run (); -u16 *create_hash_table (u16 r15, u16 r14); +u16 *create_hash_table (u16 exponent, u16 size); u16 add_to_table (u16 *table, char *username, u16 pin); // Return address of a buffer from the table // r15 = buffer address. r14 diff --git a/17-Chernobyl/Code/src/chernobyl.c b/17-Chernobyl/Code/src/chernobyl.c index 2ee4a1f..15e7ec8 100644 --- a/17-Chernobyl/Code/src/chernobyl.c +++ b/17-Chernobyl/Code/src/chernobyl.c @@ -1,4 +1,4 @@ - +// Just look at the function signatures in chernobyl.h and chernobyl_stdlib.h #include "chernobyl.h" #include @@ -21,8 +21,8 @@ u16 to_decimal (char *buf) { int main (int argc, char **argv) { if (argc == 1) { char buf[0x600] = {0}; - while (printf(">> "), _getsn (buf, 0x5ff), !feof (stdin)) { - printf ("hash: %x, dec: %x\n", hash (buf), to_decimal(buf)); + while (printf (">> "), _getsn (buf, 0x5ff), !feof (stdin)) { + printf ("hash: %x, dec: %x\n", hash (buf), to_decimal (buf)); }; } @@ -118,11 +118,11 @@ u16 add_to_table (u16 *table, char *username, u16 pin) { r12 = r12 + 3; } r12 >>= 2; - if (table[0] < r12) { // if there are more names in table than 10: - rehash(*table, r14); // Make more boxes, and shuffle them around? + if (table[0] < r12) { // if there are more names in table than 10: + rehash (*table, r14); // Make more boxes, and shuffle them around? } table[0]++; - hash(r14); + hash (r14); r12 = 1 << table[1]; // Then do some boring stuff return 0;