[PATCH] FCI work for cabinet.dll [cabinet-fci-patch-03.diff]

Alexandre Julliard julliard at winehq.org
Mon Jun 27 14:14:40 CDT 2005


"Gerold J. Wucherpfennig" <gjwucherpfennig at gmx.net> writes:

> +static cab_ULONG fci_set_little_endian_ulong( cab_ULONG i ) {
> +  unsigned char v[4];
> +  v[0]=i;
> +  v[1]=i>>8;
> +  v[2]=i>>16;
> +  v[3]=i>>24;
> +  return *((cab_ULONG*)(v));
> +}
> +
> +static cab_ULONG fci_get_little_endian_ulong( cab_ULONG i ) {
> +  unsigned char v[4];
> +  cab_ULONG r=0;
> +  memcpy(v,&i,4);
> +  r|=v[3];
> +  r<<=8;
> +  r|=v[2];
> +  r<<=8;
> +  r|=v[1];
> +  r<<=8;
> +  r|=v[0];
> +  return r;
> +}

You should use the Rtl*ByteSwap functions with the appropriate #ifdef
WORDS_BIGENDIAN, it would be a lot more efficient, particularly on
little endian platforms that represent 99.9% of the real world cases.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list