comparison fluid-mnf/misc.c @ 341:1cd24530c0ae

fluid-mnf/misc.c: passes compilation
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 13 Mar 2020 02:51:54 +0000
parents 9cecc930d78f
children f89a20e7adc7
comparison
equal deleted inserted replaced
340:435e041897f2 341:1cd24530c0ae
13 #include "misc.h" 13 #include "misc.h"
14 #include "fluid.h" 14 #include "fluid.h"
15 #include "trace.h" 15 #include "trace.h"
16 16
17 #include <stdio.h> 17 #include <stdio.h>
18 #include <string.h>
18 #include <time.h> 19 #include <time.h>
19 20
20 #if defined(MSC) || defined(BCC) 21 #if defined(MSC) || defined(BCC)
21 #include "windows.h" 22 #include "windows.h"
22 #endif 23 #endif
82 /****************************************************************************** 83 /******************************************************************************
83 * Utility Funcions 84 * Utility Funcions
84 ******************************************************************************/ 85 ******************************************************************************/
85 86
86 // Return the base 2 logarithm of <number>. Return -1 if <number> is zero. 87 // Return the base 2 logarithm of <number>. Return -1 if <number> is zero.
87 unsigned int log2(unsigned int number) 88 unsigned int my_log2(unsigned int number)
88 { 89 {
89 int result = -1; 90 int result = -1;
90 91
91 while (number > 0) { 92 while (number > 0) {
92 number >>= 1; 93 number >>= 1;
116 case 'a': 117 case 'a':
117 // We select a progress multiplier that is a power of two. Then we 118 // We select a progress multiplier that is a power of two. Then we
118 // generate a progress indicator that is in the range [16..32[ chars 119 // generate a progress indicator that is in the range [16..32[ chars
119 // in length. 120 // in length.
120 progress_mul = n / 32; 121 progress_mul = n / 32;
121 progress_mul = 1 << (log2(progress_mul) + 1); 122 progress_mul = 1 << (my_log2(progress_mul) + 1);
122 n = (n + progress_mul - 1) / progress_mul; 123 n = (n + progress_mul - 1) / progress_mul;
123 124
124 progress_string[1 + n] = ')'; 125 progress_string[1 + n] = ')';
125 progress_string[1 + n + 1] = 0; 126 progress_string[1 + n + 1] = 0;
126 127