[MPlayer-dev-eng] [PATCH] bswap.h which takes care of cpu's > 386 by using different asm commands

Michael Niedermayer michaelni at gmx.at
Sun Aug 4 15:40:28 CEST 2002


Hi

On Sunday 04 August 2002 14:55, Dirk wrote:
> [MPlayer-dev-eng] [PATCH] bswap.h which takes care of cpu's > 386 by using
> different asm commands From: Dirk <noisyb at gmx.net>
> To: "mplayer-dev-eng at mplayerhq.hu" <mplayer-dev-eng at mplayerhq.hu>
>
> this is a jazzed up version of bswap.h i'd lend the "if cpu>386 then
> other asm cmd's" from somewhere else.. so dont ask me asm questions...
> i'd test it a lot and it didn't seem to break anything... i also
> couldn't see any speedups (what might depend).. so i wont be hurt if
> this hits the trashbin.. :)

[...]
> +  unsigned char *ptr = (unsigned char *) &x, tmp;
> +  tmp = ptr[0];
> +  ptr[0] = ptr[1];
> +  ptr[1] = tmp;
> +//  return (((x) & 0x00ff) << 8 | ((x) & 0xff00) >> 8);
[...]
> +  unsigned char *ptr = (unsigned char *) &x, tmp;
> +  tmp = ptr[0];
> +  ptr[0] = ptr[3];
> +  ptr[3] = tmp;
> +  tmp = ptr[1];
> +  ptr[1] = ptr[2];
> +  ptr[2] = tmp;
> +//  return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |
> +//          (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24));
hmm, accessing the same variable in memory with different sizes (8-bit vs. 
32-bit here) could cause significant speed loss on some cpus (on some x86 
cpus for example allthough that code isnt used for x86 but other cpus might 
have the same problems ...)

it seems the only other change is in the ByteSwap64, which is almost unused

[...]

Michael



More information about the MPlayer-dev-eng mailing list