summaryrefslogtreecommitdiff
path: root/arm9/lib/include/MATH_crc.h
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2020-05-24 11:44:59 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2020-05-24 11:44:59 -0400
commitc6fc66a10eb15570050002a06c31b7a7864ffd70 (patch)
tree66a15ef0a285d93e8f9d6413a05ee0459d755edd /arm9/lib/include/MATH_crc.h
parent5246bfac368c6c59314ee6cbf95020c48beb6a51 (diff)
parentb4743f04e30937b19aca974bf2222de8fe3eb36e (diff)
Merge branch 'pikalax_work' of github.com:PikalaxALT/pokediamond into pikalax_work
Diffstat (limited to 'arm9/lib/include/MATH_crc.h')
-rw-r--r--arm9/lib/include/MATH_crc.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/arm9/lib/include/MATH_crc.h b/arm9/lib/include/MATH_crc.h
new file mode 100644
index 00000000..800b738b
--- /dev/null
+++ b/arm9/lib/include/MATH_crc.h
@@ -0,0 +1,38 @@
+#ifndef GUARD_MATH_CRC_H
+#define GUARD_MATH_CRC_H
+
+#include "types.h"
+
+typedef u8 MATHCRC8Context;
+typedef u16 MATHCRC16Context;
+typedef u32 MATHCRC32Context;
+
+struct MATHCRC8Table {
+ u8 table[256];
+};
+
+struct MATHCRC16Table {
+ u16 table[256];
+};
+
+struct MATHCRC32Table {
+ u32 table[256];
+};
+
+u32 MATH_CalcCRC32(const struct MATHCRC32Table *table, const void *data, u32 dataLength);
+void MATHi_CRC32UpdateRev(const struct MATHCRC32Table *table, MATHCRC32Context *context, const void *input, u32 length);
+u16 MATH_CalcCRC16CCITT(const struct MATHCRC16Table *table, const void *data, u32 dataLength);
+void MATHi_CRC16Update(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length);
+u16 MATH_CalcCRC16(const struct MATHCRC16Table *table, const void *data, u32 dataLength);
+void MATHi_CRC16UpdateRev(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length);
+u8 MATH_CalcCRC8(const struct MATHCRC8Table *table, const void *data, u32 dataLength);
+void MATHi_CRC8Update(const struct MATHCRC8Table *table, MATHCRC8Context *context, const void *input, u32 length);
+void MATHi_CRC32InitTableRev(struct MATHCRC32Table *table, u32 poly);
+void MATHi_CRC16UpdateRev(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length);
+void MATHi_CRC16Update(const struct MATHCRC16Table *table, MATHCRC16Context *context, const void *input, u32 length);
+void MATHi_CRC16InitTableRev(struct MATHCRC16Table *table, u16 poly);
+void MATHi_CRC16InitTable(struct MATHCRC16Table *table, u16 poly);
+void MATHi_CRC8Update(const struct MATHCRC8Table *table, MATHCRC8Context *context, const void *input, u32 length);
+void MATHi_CRC8InitTable(struct MATHCRC8Table *table, u8 poly);
+
+#endif