Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alexbevi
GitHub Repository: alexbevi/BizHawk
Path: blob/master/psx/mednadisc/cdrom/galois-inlines.h
2 views
1
/* dvdisaster: Additional error correction for optical media.
2
* Copyright (C) 2004-2007 Carsten Gnoerlich.
3
* Project home page: http://www.dvdisaster.com
4
* Email: [email protected] -or- [email protected]
5
*
6
* The Reed-Solomon error correction draws a lot of inspiration - and even code -
7
* from Phil Karn's excellent Reed-Solomon library: http://www.ka9q.net/code/fec/
8
*
9
* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,
22
* or direct your browser at http://www.gnu.org.
23
*/
24
25
#include "dvdisaster.h"
26
27
/*
28
* The following routine is performance critical.
29
*/
30
31
static inline int mod_fieldmax(int x)
32
{
33
while (x >= GF_FIELDMAX)
34
{
35
x -= GF_FIELDMAX;
36
x = (x >> GF_SYMBOLSIZE) + (x & GF_FIELDMAX);
37
}
38
39
return x;
40
}
41
42