On Mon, 27 Nov 2000, Erik Mouw wrote:
> Nice patch, although you can do the same by using mmap() and touching
> all pages before you start playing. Try this patch against mad 0.12.2b
[...]
> diff -ur mad-0.12.2b/player.c mad-0.12.2b-erik/player.c
> --- mad-0.12.2b/player.c Thu Nov 16 11:51:04 2000
> +++ mad-0.12.2b-erik/player.c Mon Nov 27 14:56:59 2000
> @@ -213,6 +213,8 @@
> struct player *player = data;
> struct input *input = &player->input;
> int len;
> + int *ptr, *endptr;
> + int dummy = 0;
>
> # if defined(HAVE_MMAP)
> if (input->fdm) {
> @@ -244,6 +246,15 @@
> return MAD_FLOW_BREAK;
> }
>
> + /* read ahead */
> + endptr = input->fdm + stat.st_size;
> + for(ptr = input->fdm; ptr < endptr; ptr += 4096)
> + dummy += *ptr; /* do something useless to fool the compiler */
> +
> + /* we need to do something with the dummy value, or otherwise the
> + compiler will optimise it away. */
> + fprintf(stderr, "*** dummy = %d\n", dummy);
Instead of filling the screen with garbage you could define a global dummy
variable with the volatile attribute.
Nicolas
Received on Mon Nov 27 07:03:13 2000
This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:43:47 EDT