summaryrefslogtreecommitdiff
path: root/map65/libm65/int.h
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2021-09-09 22:49:13 +0200
committerChristoph Berg <myon@debian.org>2021-09-09 22:49:13 +0200
commit7aa182cc9860464e41cc8b1ed7ea2419f70deb91 (patch)
treeae7d07f023c64e3faca0b852d67209a205ab2998 /map65/libm65/int.h
parent23a6b427e4bf791af53d91784c993b67f47e4635 (diff)
parent85895feeaf88bcde26bbfc71e8f6b2047c0f5f41 (diff)
Update upstream source from tag 'upstream/2.5.0_rc6+repack'
Update to upstream version '2.5.0~rc6+repack' with Debian dir b9d3381eb71d484f93fd73a092484a5814baf716
Diffstat (limited to 'map65/libm65/int.h')
-rw-r--r--map65/libm65/int.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/map65/libm65/int.h b/map65/libm65/int.h
new file mode 100644
index 00000000..ada5bfd4
--- /dev/null
+++ b/map65/libm65/int.h
@@ -0,0 +1,54 @@
+/* Include file to configure the RS codec for integer symbols
+ *
+ * Copyright 2002, Phil Karn, KA9Q
+ * May be used under the terms of the GNU General Public License (GPL)
+ */
+#define DTYPE int
+
+/* Reed-Solomon codec control block */
+struct rs {
+ unsigned int mm; /* Bits per symbol */
+ unsigned int nn; /* Symbols per block (= (1<<mm)-1) */
+ int *alpha_to; /* log lookup table */
+ int *index_of; /* Antilog lookup table */
+ int *genpoly; /* Generator polynomial */
+ unsigned int nroots; /* Number of generator roots = number of parity symbols */
+ unsigned int fcr; /* First consecutive root, index form */
+ unsigned int prim; /* Primitive element, index form */
+ unsigned int iprim; /* prim-th root of 1, index form */
+};
+
+static inline int modnn(struct rs *rs,int x){
+ while (x >= rs->nn) {
+ x -= rs->nn;
+ x = (x >> rs->mm) + (x & rs->nn);
+ }
+ return x;
+}
+#define MODNN(x) modnn(rs,x)
+
+#define MM (rs->mm)
+#define NN (rs->nn)
+#define ALPHA_TO (rs->alpha_to)
+#define INDEX_OF (rs->index_of)
+#define GENPOLY (rs->genpoly)
+#define NROOTS (rs->nroots)
+#define FCR (rs->fcr)
+#define PRIM (rs->prim)
+#define IPRIM (rs->iprim)
+#define A0 (NN)
+
+#define ENCODE_RS encode_rs_int
+#define DECODE_RS decode_rs_int
+#define INIT_RS init_rs_int
+#define FREE_RS free_rs_int
+
+void ENCODE_RS(void *p,DTYPE *data,DTYPE *parity);
+int DECODE_RS(void *p,DTYPE *data,int *eras_pos,int no_eras, int calc_syn);
+void *INIT_RS(unsigned int symsize,unsigned int gfpoly,unsigned int fcr,
+ unsigned int prim,unsigned int nroots);
+void FREE_RS(void *p);
+
+
+
+