"Gerold J. Wucherpfennig" gjwucherpfennig@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.