/* dvdisaster: Additional error correction for optical media.1* Copyright (C) 2004-2007 Carsten Gnoerlich.2* Project home page: http://www.dvdisaster.com3* Email: [email protected] -or- [email protected]4*5* The Reed-Solomon error correction draws a lot of inspiration - and even code -6* from Phil Karn's excellent Reed-Solomon library: http://www.ka9q.net/code/fec/7*8* This program is free software; you can redistribute it and/or modify9* it under the terms of the GNU General Public License as published by10* the Free Software Foundation; either version 2 of the License, or11* (at your option) any later version.12*13* This program is distributed in the hope that it will be useful,14* but WITHOUT ANY WARRANTY; without even the implied warranty of15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16* GNU General Public License for more details.17*18* You should have received a copy of the GNU General Public License19* along with this program; if not, write to the Free Software20* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,21* or direct your browser at http://www.gnu.org.22*/2324#include "dvdisaster.h"2526/*27* The following routine is performance critical.28*/2930static inline int mod_fieldmax(int x)31{32while (x >= GF_FIELDMAX)33{34x -= GF_FIELDMAX;35x = (x >> GF_SYMBOLSIZE) + (x & GF_FIELDMAX);36}3738return x;39}404142