From 7996a3d79d55b7f879dfd62e202bbfe2963718d3 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 27 Jul 2013 22:15:01 +0000 Subject: really properly move files --- libdde-linux26/contrib/include/linux/rslib.h | 109 +++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 libdde-linux26/contrib/include/linux/rslib.h (limited to 'libdde-linux26/contrib/include/linux/rslib.h') diff --git a/libdde-linux26/contrib/include/linux/rslib.h b/libdde-linux26/contrib/include/linux/rslib.h new file mode 100644 index 00000000..746580c1 --- /dev/null +++ b/libdde-linux26/contrib/include/linux/rslib.h @@ -0,0 +1,109 @@ +/* + * 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 -- cgit v1.2.3