polynomial.h (814B)
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (C) 2020 BAIKAL ELECTRONICS, JSC 4 */ 5 6#ifndef _POLYNOMIAL_H 7#define _POLYNOMIAL_H 8 9/* 10 * struct polynomial_term - one term descriptor of a polynomial 11 * @deg: degree of the term. 12 * @coef: multiplication factor of the term. 13 * @divider: distributed divider per each degree. 14 * @divider_leftover: divider leftover, which couldn't be redistributed. 15 */ 16struct polynomial_term { 17 unsigned int deg; 18 long coef; 19 long divider; 20 long divider_leftover; 21}; 22 23/* 24 * struct polynomial - a polynomial descriptor 25 * @total_divider: total data divider. 26 * @terms: polynomial terms, last term must have degree of 0 27 */ 28struct polynomial { 29 long total_divider; 30 struct polynomial_term terms[]; 31}; 32 33long polynomial_calc(const struct polynomial *poly, long data); 34 35#endif