diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-16 15:53:45 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-16 15:53:51 +0100 |
commit | b7342465e3c6f3626c04143bda12231a2d59927a (patch) | |
tree | 1a522ebbe25bbce639165bcc80f154bab2a85b8a /src | |
parent | m (diff) | |
download | fodtmf-b7342465e3c6f3626c04143bda12231a2d59927a.tar.gz fodtmf-b7342465e3c6f3626c04143bda12231a2d59927a.tar.bz2 fodtmf-b7342465e3c6f3626c04143bda12231a2d59927a.tar.xz |
m + allow less/no parity
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/send.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -177,6 +177,20 @@ static int send_byte(int c) */ static int send_byte_with_ecc(int c) { +#if PARITY < 2 + if (send_byte(c)) + return -1; +# if PARITY == 1 + if (send_byte(c)) + return -1; +# endif +# if USE_EXTRA_PARITY == 1 + if (send_byte(c)) + return -1; +# endif + return 0; + +#else static int data[(1 << PARITY) - PARITY - 1]; static int ptr = 0; static int code[(1 << PARITY) - 1 + USE_EXTRA_PARITY]; @@ -209,10 +223,10 @@ static int send_byte_with_ecc(int c) code[i - 1] = data[j]; j++; } -#ifdef USE_EXTRA_PARITY +# if USE_EXTRA_PARITY == 1 for (i = 0; i < sizeof(data) / sizeof(*data); i++) code[(1 << PARITY) - 1] ^= data[i]; -#endif +# endif /* Transmit. */ for (i = 0; i < sizeof(code) / sizeof(*code); i++) @@ -220,6 +234,7 @@ static int send_byte_with_ecc(int c) return -1; return 0; +#endif } |