![]() |
|
|||
0001 /* 0002 * dvb-math provides some complex fixed-point math 0003 * operations shared between the dvb related stuff 0004 * 0005 * Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com) 0006 * 0007 * This library is free software; you can redistribute it and/or modify 0008 * it under the terms of the GNU Lesser General Public License as 0009 * published by the Free Software Foundation; either version 2.1 of 0010 * the License, or (at your option) any later version. 0011 * 0012 * This program is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0015 * GNU Lesser General Public License for more details. 0016 */ 0017 0018 #ifndef __DVB_MATH_H 0019 #define __DVB_MATH_H 0020 0021 #include <linux/types.h> 0022 0023 /** 0024 * intlog2 - computes log2 of a value; the result is shifted left by 24 bits 0025 * 0026 * @value: The value (must be != 0) 0027 * 0028 * to use rational values you can use the following method: 0029 * 0030 * intlog2(value) = intlog2(value * 2^x) - x * 2^24 0031 * 0032 * Some usecase examples: 0033 * 0034 * intlog2(8) will give 3 << 24 = 3 * 2^24 0035 * 0036 * intlog2(9) will give 3 << 24 + ... = 3.16... * 2^24 0037 * 0038 * intlog2(1.5) = intlog2(3) - 2^24 = 0.584... * 2^24 0039 * 0040 * 0041 * return: log2(value) * 2^24 0042 */ 0043 extern unsigned int intlog2(u32 value); 0044 0045 /** 0046 * intlog10 - computes log10 of a value; the result is shifted left by 24 bits 0047 * 0048 * @value: The value (must be != 0) 0049 * 0050 * to use rational values you can use the following method: 0051 * 0052 * intlog10(value) = intlog10(value * 10^x) - x * 2^24 0053 * 0054 * An usecase example: 0055 * 0056 * intlog10(1000) will give 3 << 24 = 3 * 2^24 0057 * 0058 * due to the implementation intlog10(1000) might be not exactly 3 * 2^24 0059 * 0060 * look at intlog2 for similar examples 0061 * 0062 * return: log10(value) * 2^24 0063 */ 0064 extern unsigned int intlog10(u32 value); 0065 0066 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |