Lines Matching defs:fInt

25 #define SHIFT_AMOUNT 16 /* We multiply all original integers with 2^SHIFT_AMOUNT to get the fInt representation */
35 * A variable of type fInt can be accessed in 3 ways using the dot (.) operator
36 * fInt A;
47 } fInt;
53 static fInt ConvertToFraction(int); /* Use this to convert an INT to a FINT */
54 static fInt Convert_ULONG_ToFraction(uint32_t); /* Use this to convert an uint32_t to a FINT */
55 static fInt GetScaledFraction(int, int); /* Use this to convert an INT to a FINT after scaling it by a factor */
56 static int ConvertBackToInteger(fInt); /* Convert a FINT back to an INT that is scaled by 1000 (i.e. last 3 digits are the decimal digits) */
58 static fInt fNegate(fInt); /* Returns -1 * input fInt value */
59 static fInt fAdd (fInt, fInt); /* Returns the sum of two fInt numbers */
60 static fInt fSubtract (fInt A, fInt B); /* Returns A-B - Sometimes easier than Adding negative numbers */
61 static fInt fMultiply (fInt, fInt); /* Returns the product of two fInt numbers */
62 static fInt fDivide (fInt A, fInt B); /* Returns A/B */
63 static fInt fGetSquare(fInt); /* Returns the square of a fInt number */
64 static fInt fSqrt(fInt); /* Returns the Square Root of a fInt number */
69 static void SolveQuadracticEqn(fInt, fInt, fInt, fInt[]); /* Returns the 2 roots via the array */
70 static bool Equal(fInt, fInt); /* Returns true if two fInts are equal to each other */
71 static bool GreaterThan(fInt A, fInt B); /* Returns true if A > B */
73 static fInt fExponential(fInt exponent); /* Can be used to calculate e^exponent */
74 static fInt fNaturalLog(fInt value); /* Can be used to calculate ln(value) */
79 static fInt fDecodeLinearFuse(uint32_t fuse_value, fInt f_min, fInt f_range, uint32_t bitlength);
80 static fInt fDecodeLogisticFuse(uint32_t fuse_value, fInt f_average, fInt f_range, uint32_t bitlength);
81 static fInt fDecodeLeakageID (uint32_t leakageID_fuse, fInt ln_max_div_min, fInt f_min, uint32_t bitlength);
87 static fInt Divide (int, int); /* Divide two INTs and return result as FINT */
88 static fInt fNegate(fInt);
90 static int uGetScaledDecimal (fInt); /* Internal function */
91 static int GetReal (fInt A); /* Internal function */
108 static fInt fExponential(fInt exponent) /*Can be used to calculate e^exponent*/
113 fInt fPositiveOne = ConvertToFraction(1);
114 fInt fZERO = ConvertToFraction(0);
116 fInt lower_bound = Divide(78, 10000);
117 fInt solution = fPositiveOne; /*Starting off with baseline of 1 */
118 fInt error_term;
147 static fInt fNaturalLog(fInt value)
150 fInt upper_bound = Divide(8, 1000);
151 fInt fNegativeOne = ConvertToFraction(-1);
152 fInt solution = ConvertToFraction(0); /*Starting off with baseline of 0 */
153 fInt error_term;
172 static fInt fDecodeLinearFuse(uint32_t fuse_value, fInt f_min, fInt f_range, uint32_t bitlength)
174 fInt f_fuse_value = Convert_ULONG_ToFraction(fuse_value);
175 fInt f_bit_max_value = Convert_ULONG_ToFraction((uPow(2, bitlength)) - 1);
177 fInt f_decoded_value;
187 static fInt fDecodeLogisticFuse(uint32_t fuse_value, fInt f_average, fInt f_range, uint32_t bitlength)
189 fInt f_fuse_value = Convert_ULONG_ToFraction(fuse_value);
190 fInt f_bit_max_value = Convert_ULONG_ToFraction((uPow(2, bitlength)) - 1);
192 fInt f_CONSTANT_NEG13 = ConvertToFraction(-13);
193 fInt f_CONSTANT1 = ConvertToFraction(1);
195 fInt f_decoded_value;
205 static fInt fDecodeLeakageID (uint32_t leakageID_fuse, fInt ln_max_div_min, fInt f_min, uint32_t bitlength)
207 fInt fLeakage;
208 fInt f_bit_max_value = Convert_ULONG_ToFraction((uPow(2, bitlength)) - 1);
218 static fInt ConvertToFraction(int X) /*Add all range checking here. Is it possible to make fInt a private declaration? */
220 fInt temp;
230 static fInt fNegate(fInt X)
232 fInt CONSTANT_NEGONE = ConvertToFraction(-1);
236 static fInt Convert_ULONG_ToFraction(uint32_t X)
238 fInt temp;
248 static fInt GetScaledFraction(int X, int factor)
252 fInt fValue;
297 static fInt fAdd (fInt X, fInt Y)
299 fInt Sum;
307 static fInt fSubtract (fInt X, fInt Y)
309 fInt Difference;
316 static bool Equal(fInt A, fInt B)
324 static bool GreaterThan(fInt A, fInt B)
332 static fInt fMultiply (fInt X, fInt Y) /* Uses 64-bit integers (int64_t) */
334 fInt Product;
356 static fInt fDivide (fInt X, fInt Y)
358 fInt fZERO, fQuotient;
377 static int ConvertBackToInteger (fInt A) /*THIS is the function that will be used to check with the Golden settings table*/
379 fInt fullNumber, scaledDecimal, scaledReal;
390 static fInt fGetSquare(fInt A)
396 static fInt fSqrt(fInt num)
398 fInt F_divide_Fprime, Fprime;
399 fInt test;
400 fInt twoShifted;
402 fInt x_new, x_old, C, y;
404 fInt fZERO = ConvertToFraction(0);
453 static void SolveQuadracticEqn(fInt A, fInt B, fInt C, fInt Roots[])
455 fInt *pRoots = &Roots[0];
456 fInt temp, root_first, root_second;
457 fInt f_CONSTANT10, f_CONSTANT100;
492 static int GetReal (fInt A)
497 static fInt Divide (int X, int Y)
499 fInt A, B, Quotient;
509 static int uGetScaledDecimal (fInt A) /*Converts the fractional portion to whole integers - Costly function */
540 static fInt fRoundUpByStepSize(fInt A, fInt fStepSize, bool error_term)
542 fInt solution;