/* * include/linux/rslib.h * * Overview: * Generic Reed Solomon encoder / decoder library * * Copyright (C) 2004 Thomas Gleixner (tglx@linutronix.de) * * RS code lifted from reed solomon library written by Phil Karn * Copyright 2002 Phil Karn, KA9Q * * $Id: rslib.h,v 1.4 2005/11/07 11:14:52 gleixner Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef _RSLIB_H_ #define _RSLIB_H_ #include /** * struct rs_control - rs control structure * * @mm: Bits per symbol * @nn: Symbols per block (= (1<mm = number of bits per symbol * rs->nn = (2^rs->mm) - 1 * * Simple arithmetic modulo would return a wrong result for values * >= 3 * rs->nn */ static inline int rs_modnn(struct rs_control *rs, int x) { while (x >= rs->nn) { x -= rs->nn; x = (x >> rs->mm) + (x & rs->nn); } return x; } #endif