3 * Provides routines for encoding and decoding the extended Golay
6 * This implementation will detect up to 4 errors in a codeword (without
7 * being able to correct them); it will correct up to 3 errors.
9 * We use guint32s to hold the 24-bit codewords, with the data part in
10 * the bottom 12 bits and the parity in bits 12-23.
13 * Wireshark - Network traffic analyzer
14 * By Gerald Combs <gerald@wireshark.org>
15 * Copyright 1998 Gerald Combs
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version 2
20 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 /* encodes a 12-bit word to a 24-bit codeword
36 guint32 golay_encode(guint w);
38 /* return a mask showing the bits which are in error in a received
39 * 24-bit codeword, or -1 if 4 errors were detected.
41 gint32 golay_errors(guint32 codeword);
43 /* decode a received codeword. Up to 3 errors are corrected for; 4
44 errors are detected as uncorrectable (return -1); 5 or more errors
45 cause an incorrect correction.
47 gint golay_decode(guint32 w);