You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
299 lines
17 KiB
Go
299 lines
17 KiB
Go
package fec
|
|
|
|
var (
|
|
golayGenerator = [12]uint32{
|
|
0x063a, 0x031d, 0x07b4, 0x03da,
|
|
0x01ed, 0x06cc, 0x0366, 0x01b3,
|
|
0x06e3, 0x054b, 0x049f, 0x0475,
|
|
}
|
|
golayMatrix = [2048]uint32{
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0048,
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0824,
|
|
0x0000, 0x0000, 0x0000, 0x0301, 0x0000, 0x0400, 0x0090, 0x0002,
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0048,
|
|
0x0000, 0x0000, 0x0000, 0x0048, 0x0000, 0x0048, 0x0048, 0x0048,
|
|
0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0001, 0x0602, 0x0180,
|
|
0x0000, 0x0086, 0x0800, 0x0420, 0x0120, 0x0a10, 0x0005, 0x0048,
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0500,
|
|
0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0222, 0x0090, 0x0801,
|
|
0x0000, 0x0000, 0x0000, 0x0042, 0x0000, 0x0001, 0x0090, 0x0208,
|
|
0x0000, 0x0808, 0x0090, 0x0420, 0x0090, 0x0144, 0x0090, 0x0090,
|
|
0x0000, 0x0000, 0x0000, 0x0a80, 0x0000, 0x0001, 0x0020, 0x0016,
|
|
0x0000, 0x0110, 0x0003, 0x0420, 0x0c04, 0x0080, 0x0300, 0x0048,
|
|
0x0000, 0x0001, 0x010c, 0x0420, 0x0001, 0x0001, 0x0840, 0x0001,
|
|
0x0240, 0x0420, 0x0420, 0x0420, 0x000a, 0x0001, 0x0090, 0x0420,
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0500,
|
|
0x0000, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0015, 0x0a00, 0x0002,
|
|
0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x02c0, 0x0009, 0x0002,
|
|
0x0000, 0x0808, 0x0444, 0x0002, 0x0120, 0x0002, 0x0002, 0x0002,
|
|
0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0802, 0x0084, 0x0221,
|
|
0x0000, 0x0600, 0x0003, 0x0904, 0x0120, 0x0080, 0x0410, 0x0048,
|
|
0x0000, 0x0010, 0x0010, 0x0010, 0x0120, 0x040c, 0x0840, 0x0010,
|
|
0x0120, 0x0041, 0x0288, 0x0010, 0x0120, 0x0120, 0x0120, 0x0002,
|
|
0x0000, 0x0000, 0x0000, 0x0500, 0x0000, 0x0500, 0x0500, 0x0500,
|
|
0x0000, 0x0808, 0x0003, 0x0250, 0x0040, 0x0080, 0x002c, 0x0500,
|
|
0x0000, 0x0808, 0x0220, 0x0085, 0x0006, 0x0030, 0x0840, 0x0500,
|
|
0x0808, 0x0808, 0x0100, 0x0808, 0x0601, 0x0808, 0x0090, 0x0002,
|
|
0x0000, 0x0064, 0x0003, 0x0008, 0x0218, 0x0080, 0x0840, 0x0500,
|
|
0x0003, 0x0080, 0x0003, 0x0003, 0x0080, 0x0080, 0x0003, 0x0080,
|
|
0x0480, 0x0302, 0x0840, 0x0010, 0x0840, 0x0001, 0x0840, 0x0840,
|
|
0x0014, 0x0808, 0x0003, 0x0420, 0x0120, 0x0080, 0x0840, 0x0204,
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0083,
|
|
0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0400, 0x0a00, 0x0130,
|
|
0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0400, 0x0140, 0x0208,
|
|
0x0000, 0x0400, 0x002a, 0x08c0, 0x0400, 0x0400, 0x0005, 0x0400,
|
|
0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0304, 0x0020, 0x0c00,
|
|
0x0000, 0x0821, 0x0580, 0x0202, 0x0012, 0x0080, 0x0005, 0x0048,
|
|
0x0000, 0x0010, 0x0010, 0x0010, 0x0888, 0x0062, 0x0005, 0x0010,
|
|
0x0240, 0x0108, 0x0005, 0x0010, 0x0005, 0x0400, 0x0005, 0x0005,
|
|
0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0850, 0x0020, 0x0208,
|
|
0x0000, 0x0004, 0x0004, 0x0004, 0x0109, 0x0080, 0x0442, 0x0004,
|
|
0x0000, 0x01a0, 0x0c01, 0x0208, 0x0006, 0x0208, 0x0208, 0x0208,
|
|
0x0240, 0x0013, 0x0100, 0x0004, 0x0820, 0x0400, 0x0090, 0x0208,
|
|
0x0000, 0x040a, 0x0020, 0x0141, 0x0020, 0x0080, 0x0020, 0x0020,
|
|
0x0240, 0x0080, 0x0818, 0x0004, 0x0080, 0x0080, 0x0020, 0x0080,
|
|
0x0240, 0x0804, 0x0082, 0x0010, 0x0510, 0x0001, 0x0020, 0x0208,
|
|
0x0240, 0x0240, 0x0240, 0x0420, 0x0240, 0x0080, 0x0005, 0x0902,
|
|
0x0000, 0x0000, 0x0000, 0x0010, 0x0000, 0x0028, 0x0a00, 0x0044,
|
|
0x0000, 0x0142, 0x0a00, 0x0409, 0x0a00, 0x0080, 0x0a00, 0x0a00,
|
|
0x0000, 0x0010, 0x0010, 0x0010, 0x0006, 0x0901, 0x04a0, 0x0010,
|
|
0x0081, 0x0224, 0x0100, 0x0010, 0x0058, 0x0400, 0x0a00, 0x0002,
|
|
0x0000, 0x0010, 0x0010, 0x0010, 0x0441, 0x0080, 0x010a, 0x0010,
|
|
0x000c, 0x0080, 0x0060, 0x0010, 0x0080, 0x0080, 0x0a00, 0x0080,
|
|
0x0010, 0x0010, 0x0010, 0x0010, 0x0200, 0x0010, 0x0010, 0x0010,
|
|
0x0c02, 0x0010, 0x0010, 0x0010, 0x0120, 0x0080, 0x0005, 0x0010,
|
|
0x0000, 0x0201, 0x00c8, 0x0822, 0x0006, 0x0080, 0x0011, 0x0500,
|
|
0x0430, 0x0080, 0x0100, 0x0004, 0x0080, 0x0080, 0x0a00, 0x0080,
|
|
0x0006, 0x0440, 0x0100, 0x0010, 0x0006, 0x0006, 0x0006, 0x0208,
|
|
0x0100, 0x0808, 0x0100, 0x0100, 0x0006, 0x0080, 0x0100, 0x0061,
|
|
0x0900, 0x0080, 0x0604, 0x0010, 0x0080, 0x0080, 0x0020, 0x0080,
|
|
0x0080, 0x0080, 0x0003, 0x0080, 0x0080, 0x0080, 0x0080, 0x0080,
|
|
0x0029, 0x0010, 0x0010, 0x0010, 0x0006, 0x0080, 0x0840, 0x0010,
|
|
0x0240, 0x0080, 0x0100, 0x0010, 0x0080, 0x0080, 0x0408, 0x0080,
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0210,
|
|
0x0000, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0400, 0x0106, 0x0801,
|
|
0x0000, 0x0000, 0x0000, 0x0042, 0x0000, 0x0400, 0x0009, 0x0180,
|
|
0x0000, 0x0400, 0x0800, 0x001c, 0x0400, 0x0400, 0x0260, 0x0400,
|
|
0x0000, 0x0000, 0x0000, 0x0405, 0x0000, 0x0802, 0x0020, 0x0180,
|
|
0x0000, 0x0110, 0x0800, 0x0202, 0x0281, 0x0024, 0x0410, 0x0048,
|
|
0x0000, 0x0228, 0x0800, 0x0180, 0x0054, 0x0180, 0x0180, 0x0180,
|
|
0x0800, 0x0041, 0x0800, 0x0800, 0x000a, 0x0400, 0x0800, 0x0180,
|
|
0x0000, 0x0000, 0x0000, 0x0042, 0x0000, 0x008c, 0x0020, 0x0801,
|
|
0x0000, 0x0110, 0x0608, 0x0801, 0x0040, 0x0801, 0x0801, 0x0801,
|
|
0x0000, 0x0042, 0x0042, 0x0042, 0x0b00, 0x0030, 0x0404, 0x0042,
|
|
0x0025, 0x0280, 0x0100, 0x0042, 0x000a, 0x0400, 0x0090, 0x0801,
|
|
0x0000, 0x0110, 0x0020, 0x0008, 0x0020, 0x0640, 0x0020, 0x0020,
|
|
0x0110, 0x0110, 0x00c4, 0x0110, 0x000a, 0x0110, 0x0020, 0x0801,
|
|
0x0480, 0x0804, 0x0211, 0x0042, 0x000a, 0x0001, 0x0020, 0x0180,
|
|
0x000a, 0x0110, 0x0800, 0x0420, 0x000a, 0x000a, 0x000a, 0x0204,
|
|
0x0000, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0802, 0x0009, 0x0044,
|
|
0x0000, 0x00a0, 0x00a0, 0x00a0, 0x0040, 0x0308, 0x0410, 0x00a0,
|
|
0x0000, 0x0104, 0x0009, 0x0e00, 0x0009, 0x0030, 0x0009, 0x0009,
|
|
0x0212, 0x0041, 0x0100, 0x00a0, 0x0884, 0x0400, 0x0009, 0x0002,
|
|
0x0000, 0x0802, 0x0340, 0x0008, 0x0802, 0x0802, 0x0410, 0x0802,
|
|
0x000c, 0x0041, 0x0410, 0x00a0, 0x0410, 0x0802, 0x0410, 0x0410,
|
|
0x0480, 0x0041, 0x0026, 0x0010, 0x0200, 0x0802, 0x0009, 0x0180,
|
|
0x0041, 0x0041, 0x0800, 0x0041, 0x0120, 0x0041, 0x0410, 0x0204,
|
|
0x0000, 0x0201, 0x0814, 0x0008, 0x0040, 0x0030, 0x0282, 0x0500,
|
|
0x0040, 0x0406, 0x0100, 0x00a0, 0x0040, 0x0040, 0x0040, 0x0801,
|
|
0x0480, 0x0030, 0x0100, 0x0042, 0x0030, 0x0030, 0x0009, 0x0030,
|
|
0x0100, 0x0808, 0x0100, 0x0100, 0x0040, 0x0030, 0x0100, 0x0204,
|
|
0x0480, 0x0008, 0x0008, 0x0008, 0x0105, 0x0802, 0x0020, 0x0008,
|
|
0x0a20, 0x0110, 0x0003, 0x0008, 0x0040, 0x0080, 0x0410, 0x0204,
|
|
0x0480, 0x0480, 0x0480, 0x0008, 0x0480, 0x0030, 0x0840, 0x0204,
|
|
0x0480, 0x0041, 0x0100, 0x0204, 0x000a, 0x0204, 0x0204, 0x0204,
|
|
0x0000, 0x0000, 0x0000, 0x0908, 0x0000, 0x0400, 0x0020, 0x0044,
|
|
0x0000, 0x0400, 0x0051, 0x0202, 0x0400, 0x0400, 0x0088, 0x0400,
|
|
0x0000, 0x0400, 0x0284, 0x0021, 0x0400, 0x0400, 0x0812, 0x0400,
|
|
0x0400, 0x0400, 0x0100, 0x0400, 0x0400, 0x0400, 0x0400, 0x0400,
|
|
0x0000, 0x00c0, 0x0020, 0x0202, 0x0020, 0x0019, 0x0020, 0x0020,
|
|
0x000c, 0x0202, 0x0202, 0x0202, 0x0940, 0x0400, 0x0020, 0x0202,
|
|
0x0103, 0x0804, 0x0448, 0x0010, 0x0200, 0x0400, 0x0020, 0x0180,
|
|
0x00b0, 0x0400, 0x0800, 0x0202, 0x0400, 0x0400, 0x0005, 0x0400,
|
|
0x0000, 0x0201, 0x0020, 0x0490, 0x0020, 0x0102, 0x0020, 0x0020,
|
|
0x0882, 0x0068, 0x0100, 0x0004, 0x0214, 0x0400, 0x0020, 0x0801,
|
|
0x0018, 0x0804, 0x0100, 0x0042, 0x00c1, 0x0400, 0x0020, 0x0208,
|
|
0x0100, 0x0400, 0x0100, 0x0100, 0x0400, 0x0400, 0x0100, 0x0400,
|
|
0x0020, 0x0804, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020,
|
|
0x0401, 0x0110, 0x0020, 0x0202, 0x0020, 0x0080, 0x0020, 0x0020,
|
|
0x0804, 0x0804, 0x0020, 0x0804, 0x0020, 0x0804, 0x0020, 0x0020,
|
|
0x0240, 0x0804, 0x0100, 0x0089, 0x000a, 0x0400, 0x0020, 0x0050,
|
|
0x0000, 0x0201, 0x0402, 0x0044, 0x0190, 0x0044, 0x0044, 0x0044,
|
|
0x000c, 0x0810, 0x0100, 0x00a0, 0x0023, 0x0400, 0x0a00, 0x0044,
|
|
0x0860, 0x008a, 0x0100, 0x0010, 0x0200, 0x0400, 0x0009, 0x0044,
|
|
0x0100, 0x0400, 0x0100, 0x0100, 0x0400, 0x0400, 0x0100, 0x0400,
|
|
0x000c, 0x0520, 0x0881, 0x0010, 0x0200, 0x0802, 0x0020, 0x0044,
|
|
0x000c, 0x000c, 0x000c, 0x0202, 0x000c, 0x0080, 0x0410, 0x0101,
|
|
0x0200, 0x0010, 0x0010, 0x0010, 0x0200, 0x0200, 0x0200, 0x0010,
|
|
0x000c, 0x0041, 0x0100, 0x0010, 0x0200, 0x0400, 0x00c2, 0x0828,
|
|
0x0201, 0x0201, 0x0100, 0x0201, 0x0c08, 0x0201, 0x0020, 0x0044,
|
|
0x0100, 0x0201, 0x0100, 0x0100, 0x0040, 0x0080, 0x0100, 0x001a,
|
|
0x0100, 0x0201, 0x0100, 0x0100, 0x0006, 0x0030, 0x0100, 0x0880,
|
|
0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0400, 0x0100, 0x0100,
|
|
0x0052, 0x0201, 0x0020, 0x0008, 0x0020, 0x0080, 0x0020, 0x0020,
|
|
0x000c, 0x0080, 0x0100, 0x0c40, 0x0080, 0x0080, 0x0020, 0x0080,
|
|
0x0480, 0x0804, 0x0100, 0x0010, 0x0200, 0x0148, 0x0020, 0x0403,
|
|
0x0100, 0x0022, 0x0100, 0x0100, 0x0811, 0x0080, 0x0100, 0x0204,
|
|
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0210,
|
|
0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0980, 0x0421, 0x0002,
|
|
0x0000, 0x0000, 0x0000, 0x0488, 0x0000, 0x0001, 0x0140, 0x0002,
|
|
0x0000, 0x0070, 0x0800, 0x0002, 0x020c, 0x0002, 0x0002, 0x0002,
|
|
0x0000, 0x0000, 0x0000, 0x0122, 0x0000, 0x0001, 0x0084, 0x0c00,
|
|
0x0000, 0x0600, 0x0800, 0x0091, 0x0012, 0x0024, 0x0300, 0x0048,
|
|
0x0000, 0x0001, 0x0800, 0x0244, 0x0001, 0x0001, 0x0038, 0x0001,
|
|
0x0800, 0x0108, 0x0800, 0x0800, 0x04c0, 0x0001, 0x0800, 0x0002,
|
|
0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0001, 0x080a, 0x00e0,
|
|
0x0000, 0x0004, 0x0004, 0x0004, 0x0040, 0x0418, 0x0300, 0x0004,
|
|
0x0000, 0x0001, 0x0220, 0x0910, 0x0001, 0x0001, 0x0404, 0x0001,
|
|
0x0502, 0x0280, 0x0049, 0x0004, 0x0820, 0x0001, 0x0090, 0x0002,
|
|
0x0000, 0x0001, 0x0450, 0x0008, 0x0001, 0x0001, 0x0300, 0x0001,
|
|
0x00a8, 0x0842, 0x0300, 0x0004, 0x0300, 0x0001, 0x0300, 0x0300,
|
|
0x0001, 0x0001, 0x0082, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
|
|
0x0014, 0x0001, 0x0800, 0x0420, 0x0001, 0x0001, 0x0300, 0x0001,
|
|
0x0000, 0x0000, 0x0000, 0x0841, 0x0000, 0x0028, 0x0084, 0x0002,
|
|
0x0000, 0x0600, 0x0118, 0x0002, 0x0040, 0x0002, 0x0002, 0x0002,
|
|
0x0000, 0x0104, 0x0220, 0x0002, 0x0c10, 0x0002, 0x0002, 0x0002,
|
|
0x0081, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002,
|
|
0x0000, 0x0600, 0x0084, 0x0008, 0x0084, 0x0150, 0x0084, 0x0084,
|
|
0x0600, 0x0600, 0x0060, 0x0600, 0x0809, 0x0600, 0x0084, 0x0002,
|
|
0x004a, 0x08a0, 0x0501, 0x0010, 0x0200, 0x0001, 0x0084, 0x0002,
|
|
0x0014, 0x0600, 0x0800, 0x0002, 0x0120, 0x0002, 0x0002, 0x0002,
|
|
0x0000, 0x0092, 0x0220, 0x0008, 0x0040, 0x0a04, 0x0011, 0x0500,
|
|
0x0040, 0x0121, 0x0c80, 0x0004, 0x0040, 0x0040, 0x0040, 0x0002,
|
|
0x0220, 0x0440, 0x0220, 0x0220, 0x0188, 0x0001, 0x0220, 0x0002,
|
|
0x0014, 0x0808, 0x0220, 0x0002, 0x0040, 0x0002, 0x0002, 0x0002,
|
|
0x0900, 0x0008, 0x0008, 0x0008, 0x0422, 0x0001, 0x0084, 0x0008,
|
|
0x0014, 0x0600, 0x0003, 0x0008, 0x0040, 0x0080, 0x0300, 0x0830,
|
|
0x0014, 0x0001, 0x0220, 0x0008, 0x0001, 0x0001, 0x0840, 0x0001,
|
|
0x0014, 0x0014, 0x0014, 0x01c0, 0x0014, 0x0001, 0x0408, 0x0002,
|
|
0x0000, 0x0000, 0x0000, 0x0004, 0x0000, 0x0028, 0x0140, 0x0c00,
|
|
0x0000, 0x0004, 0x0004, 0x0004, 0x0012, 0x0241, 0x0088, 0x0004,
|
|
0x0000, 0x0a02, 0x0140, 0x0021, 0x0140, 0x0094, 0x0140, 0x0140,
|
|
0x0081, 0x0108, 0x0610, 0x0004, 0x0820, 0x0400, 0x0140, 0x0002,
|
|
0x0000, 0x00c0, 0x0209, 0x0c00, 0x0012, 0x0c00, 0x0c00, 0x0c00,
|
|
0x0012, 0x0108, 0x0060, 0x0004, 0x0012, 0x0012, 0x0012, 0x0c00,
|
|
0x0424, 0x0108, 0x0082, 0x0010, 0x0200, 0x0001, 0x0140, 0x0c00,
|
|
0x0108, 0x0108, 0x0800, 0x0108, 0x0012, 0x0108, 0x0005, 0x02a0,
|
|
0x0000, 0x0004, 0x0004, 0x0004, 0x0680, 0x0102, 0x0011, 0x0004,
|
|
0x0004, 0x0004, 0x0004, 0x0004, 0x0820, 0x0004, 0x0004, 0x0004,
|
|
0x0018, 0x0440, 0x0082, 0x0004, 0x0820, 0x0001, 0x0140, 0x0208,
|
|
0x0820, 0x0004, 0x0004, 0x0004, 0x0820, 0x0820, 0x0820, 0x0004,
|
|
0x0900, 0x0230, 0x0082, 0x0004, 0x004c, 0x0001, 0x0020, 0x0c00,
|
|
0x0401, 0x0004, 0x0004, 0x0004, 0x0012, 0x0080, 0x0300, 0x0004,
|
|
0x0082, 0x0001, 0x0082, 0x0082, 0x0001, 0x0001, 0x0082, 0x0001,
|
|
0x0240, 0x0108, 0x0082, 0x0004, 0x0820, 0x0001, 0x0408, 0x0050,
|
|
0x0000, 0x0028, 0x0402, 0x0380, 0x0028, 0x0028, 0x0011, 0x0028,
|
|
0x0081, 0x0810, 0x0060, 0x0004, 0x0504, 0x0028, 0x0a00, 0x0002,
|
|
0x0081, 0x0440, 0x080c, 0x0010, 0x0200, 0x0028, 0x0140, 0x0002,
|
|
0x0081, 0x0081, 0x0081, 0x0002, 0x0081, 0x0002, 0x0002, 0x0002,
|
|
0x0900, 0x0007, 0x0060, 0x0010, 0x0200, 0x0028, 0x0084, 0x0c00,
|
|
0x0060, 0x0600, 0x0060, 0x0060, 0x0012, 0x0080, 0x0060, 0x0101,
|
|
0x0200, 0x0010, 0x0010, 0x0010, 0x0200, 0x0200, 0x0200, 0x0010,
|
|
0x0081, 0x0108, 0x0060, 0x0010, 0x0200, 0x0844, 0x0408, 0x0002,
|
|
0x0900, 0x0440, 0x0011, 0x0004, 0x0011, 0x0028, 0x0011, 0x0011,
|
|
0x020a, 0x0004, 0x0004, 0x0004, 0x0040, 0x0080, 0x0011, 0x0004,
|
|
0x0440, 0x0440, 0x0220, 0x0440, 0x0006, 0x0440, 0x0011, 0x0880,
|
|
0x0081, 0x0440, 0x0100, 0x0004, 0x0820, 0x0310, 0x0408, 0x0002,
|
|
0x0900, 0x0900, 0x0900, 0x0008, 0x0900, 0x0080, 0x0011, 0x0242,
|
|
0x0900, 0x0080, 0x0060, 0x0004, 0x0080, 0x0080, 0x0408, 0x0080,
|
|
0x0900, 0x0440, 0x0082, 0x0010, 0x0200, 0x0001, 0x0408, 0x0124,
|
|
0x0014, 0x0022, 0x0408, 0x0a01, 0x0408, 0x0080, 0x0408, 0x0408,
|
|
0x0000, 0x0000, 0x0000, 0x0210, 0x0000, 0x0210, 0x0210, 0x0210,
|
|
0x0000, 0x000b, 0x0800, 0x0540, 0x0040, 0x0024, 0x0088, 0x0210,
|
|
0x0000, 0x0104, 0x0800, 0x0021, 0x00a2, 0x0848, 0x0404, 0x0210,
|
|
0x0800, 0x0280, 0x0800, 0x0800, 0x0111, 0x0400, 0x0800, 0x0002,
|
|
0x0000, 0x00c0, 0x0800, 0x0008, 0x0508, 0x0024, 0x0043, 0x0210,
|
|
0x0800, 0x0024, 0x0800, 0x0800, 0x0024, 0x0024, 0x0800, 0x0024,
|
|
0x0800, 0x0412, 0x0800, 0x0800, 0x0200, 0x0001, 0x0800, 0x0180,
|
|
0x0800, 0x0800, 0x0800, 0x0800, 0x0800, 0x0024, 0x0800, 0x0800,
|
|
0x0000, 0x0c20, 0x0181, 0x0008, 0x0040, 0x0102, 0x0404, 0x0210,
|
|
0x0040, 0x0280, 0x0032, 0x0004, 0x0040, 0x0040, 0x0040, 0x0801,
|
|
0x0018, 0x0280, 0x0404, 0x0042, 0x0404, 0x0001, 0x0404, 0x0404,
|
|
0x0280, 0x0280, 0x0800, 0x0280, 0x0040, 0x0280, 0x0404, 0x0128,
|
|
0x0206, 0x0008, 0x0008, 0x0008, 0x0890, 0x0001, 0x0020, 0x0008,
|
|
0x0401, 0x0110, 0x0800, 0x0008, 0x0040, 0x0024, 0x0300, 0x0482,
|
|
0x0160, 0x0001, 0x0800, 0x0008, 0x0001, 0x0001, 0x0404, 0x0001,
|
|
0x0800, 0x0280, 0x0800, 0x0800, 0x000a, 0x0001, 0x0800, 0x0050,
|
|
0x0000, 0x0104, 0x0402, 0x0008, 0x0040, 0x0481, 0x0920, 0x0210,
|
|
0x0040, 0x0810, 0x0205, 0x00a0, 0x0040, 0x0040, 0x0040, 0x0002,
|
|
0x0104, 0x0104, 0x00d0, 0x0104, 0x0200, 0x0104, 0x0009, 0x0002,
|
|
0x0428, 0x0104, 0x0800, 0x0002, 0x0040, 0x0002, 0x0002, 0x0002,
|
|
0x0031, 0x0008, 0x0008, 0x0008, 0x0200, 0x0802, 0x0084, 0x0008,
|
|
0x0182, 0x0600, 0x0800, 0x0008, 0x0040, 0x0024, 0x0410, 0x0101,
|
|
0x0200, 0x0104, 0x0800, 0x0008, 0x0200, 0x0200, 0x0200, 0x0460,
|
|
0x0800, 0x0041, 0x0800, 0x0800, 0x0200, 0x0098, 0x0800, 0x0002,
|
|
0x0040, 0x0008, 0x0008, 0x0008, 0x0040, 0x0040, 0x0040, 0x0008,
|
|
0x0040, 0x0040, 0x0040, 0x0008, 0x0040, 0x0040, 0x0040, 0x0040,
|
|
0x0803, 0x0104, 0x0220, 0x0008, 0x0040, 0x0030, 0x0404, 0x0880,
|
|
0x0040, 0x0280, 0x0100, 0x0411, 0x0040, 0x0040, 0x0040, 0x0002,
|
|
0x0008, 0x0008, 0x0008, 0x0008, 0x0040, 0x0008, 0x0008, 0x0008,
|
|
0x0040, 0x0008, 0x0008, 0x0008, 0x0040, 0x0040, 0x0040, 0x0008,
|
|
0x0480, 0x0008, 0x0008, 0x0008, 0x0200, 0x0001, 0x0112, 0x0008,
|
|
0x0014, 0x0022, 0x0800, 0x0008, 0x0040, 0x0d00, 0x00a1, 0x0204,
|
|
0x0000, 0x00c0, 0x0402, 0x0021, 0x0805, 0x0102, 0x0088, 0x0210,
|
|
0x0320, 0x0810, 0x0088, 0x0004, 0x0088, 0x0400, 0x0088, 0x0088,
|
|
0x0018, 0x0021, 0x0021, 0x0021, 0x0200, 0x0400, 0x0140, 0x0021,
|
|
0x0046, 0x0400, 0x0800, 0x0021, 0x0400, 0x0400, 0x0088, 0x0400,
|
|
0x00c0, 0x00c0, 0x0114, 0x00c0, 0x0200, 0x00c0, 0x0020, 0x0c00,
|
|
0x0401, 0x00c0, 0x0800, 0x0202, 0x0012, 0x0024, 0x0088, 0x0101,
|
|
0x0200, 0x00c0, 0x0800, 0x0021, 0x0200, 0x0200, 0x0200, 0x000e,
|
|
0x0800, 0x0108, 0x0800, 0x0800, 0x0200, 0x0400, 0x0800, 0x0050,
|
|
0x0018, 0x0102, 0x0a40, 0x0004, 0x0102, 0x0102, 0x0020, 0x0102,
|
|
0x0401, 0x0004, 0x0004, 0x0004, 0x0040, 0x0102, 0x0088, 0x0004,
|
|
0x0018, 0x0018, 0x0018, 0x0021, 0x0018, 0x0102, 0x0404, 0x0880,
|
|
0x0018, 0x0280, 0x0100, 0x0004, 0x0820, 0x0400, 0x0203, 0x0050,
|
|
0x0401, 0x00c0, 0x0020, 0x0008, 0x0020, 0x0102, 0x0020, 0x0020,
|
|
0x0401, 0x0401, 0x0401, 0x0004, 0x0401, 0x0a08, 0x0020, 0x0050,
|
|
0x0018, 0x0804, 0x0082, 0x0700, 0x0200, 0x0001, 0x0020, 0x0050,
|
|
0x0401, 0x0022, 0x0800, 0x0050, 0x0184, 0x0050, 0x0050, 0x0050,
|
|
0x0402, 0x0810, 0x0402, 0x0402, 0x0200, 0x0028, 0x0402, 0x0044,
|
|
0x0810, 0x0810, 0x0402, 0x0810, 0x0040, 0x0810, 0x0088, 0x0101,
|
|
0x0200, 0x0104, 0x0402, 0x0021, 0x0200, 0x0200, 0x0200, 0x0880,
|
|
0x0081, 0x0810, 0x0100, 0x0248, 0x0200, 0x0400, 0x0034, 0x0002,
|
|
0x0200, 0x00c0, 0x0402, 0x0008, 0x0200, 0x0200, 0x0200, 0x0101,
|
|
0x000c, 0x0810, 0x0060, 0x0101, 0x0200, 0x0101, 0x0101, 0x0101,
|
|
0x0200, 0x0200, 0x0200, 0x0010, 0x0200, 0x0200, 0x0200, 0x0200,
|
|
0x0200, 0x0022, 0x0800, 0x0484, 0x0200, 0x0200, 0x0200, 0x0101,
|
|
0x00a4, 0x0201, 0x0402, 0x0008, 0x0040, 0x0102, 0x0011, 0x0880,
|
|
0x0040, 0x0810, 0x0100, 0x0004, 0x0040, 0x0040, 0x0040, 0x0620,
|
|
0x0018, 0x0440, 0x0100, 0x0880, 0x0200, 0x0880, 0x0880, 0x0880,
|
|
0x0100, 0x0022, 0x0100, 0x0100, 0x0040, 0x000d, 0x0100, 0x0880,
|
|
0x0900, 0x0008, 0x0008, 0x0008, 0x0200, 0x0414, 0x0020, 0x0008,
|
|
0x0401, 0x0022, 0x0290, 0x0008, 0x0040, 0x0080, 0x0806, 0x0101,
|
|
0x0200, 0x0022, 0x0045, 0x0008, 0x0200, 0x0200, 0x0200, 0x0880,
|
|
0x0022, 0x0022, 0x0100, 0x0022, 0x0200, 0x0022, 0x0408, 0x0050,
|
|
}
|
|
)
|
|
|
|
// Golay(23, 12) forward error correction.
|
|
func Golay_23_12_Correct(block *uint32) {
|
|
var (
|
|
mask = uint32(0x400000)
|
|
curr = *block
|
|
syndrome uint32
|
|
)
|
|
|
|
for i := 0; i < 12; i++ {
|
|
if (curr & mask) != 0 {
|
|
syndrome ^= golayGenerator[i]
|
|
}
|
|
mask >>= 1
|
|
}
|
|
|
|
syndrome ^= (curr & 0x07ff)
|
|
*block = ((curr >> 11) ^ golayMatrix[syndrome])
|
|
}
|
|
|
|
// Golay(23, 12) codeword.
|
|
func Golay_23_12_Encode(codeword uint32) uint32 {
|
|
var c = codeword
|
|
for i := 0; i < 12; i++ {
|
|
if codeword&1 == 1 { // Test data bit
|
|
codeword ^= 0xc75 // XOR polynomial
|
|
codeword >>= 1 // Shift intermediate result
|
|
}
|
|
}
|
|
return ((codeword << 12) | c) // Assemble encoded codeword
|
|
}
|