53 |
|
#endif |
54 |
|
|
55 |
|
#ifdef ENABLE_VOSF |
56 |
– |
# include <math.h> // log() |
56 |
|
# include <unistd.h> |
57 |
|
# include <signal.h> |
58 |
|
# include <fcntl.h> |
218 |
|
static pthread_mutex_t Screen_draw_lock = PTHREAD_MUTEX_INITIALIZER; // Mutex to protect frame buffer (dirtyPages in fact) |
219 |
|
#endif |
220 |
|
|
221 |
+ |
static int log_base_2(uint32 x) |
222 |
+ |
{ |
223 |
+ |
uint32 mask = 0x80000000; |
224 |
+ |
int l = 31; |
225 |
+ |
while (l >= 0 && (x & mask) == 0) { |
226 |
+ |
mask >>= 1; |
227 |
+ |
l--; |
228 |
+ |
} |
229 |
+ |
return l; |
230 |
+ |
} |
231 |
+ |
|
232 |
|
#endif |
233 |
|
|
234 |
|
// VideoRefresh function |
814 |
|
|
815 |
|
mainBuffer.pageSize = page_size; |
816 |
|
mainBuffer.pageCount = (mainBuffer.memLength + page_mask)/mainBuffer.pageSize; |
817 |
< |
mainBuffer.pageBits = int( log(mainBuffer.pageSize) / log(2.0) ); |
817 |
> |
mainBuffer.pageBits = log_base_2(mainBuffer.pageSize); |
818 |
|
|
819 |
|
if (mainBuffer.dirtyPages != 0) |
820 |
|
free(mainBuffer.dirtyPages); |
1776 |
|
for (i=(VideoMonitor.x>>3); i>(x2>>3); i--) { |
1777 |
|
p--; p2--; |
1778 |
|
if (*p != *p2) { |
1779 |
< |
x2 = i << 3; |
1779 |
> |
x2 = (i << 3) + 7; |
1780 |
|
break; |
1781 |
|
} |
1782 |
|
} |
1783 |
|
} |
1784 |
< |
wide = x2 - x1; |
1784 |
> |
wide = x2 - x1 + 1; |
1785 |
|
|
1786 |
|
// Update copy of the_buffer |
1787 |
|
if (high && wide) { |