hedgewars/uMisc.pas
changeset 2670 1b327b7515ed
parent 2666 2b8c8f16421e
child 2671 7e0f88013fe8
--- a/hedgewars/uMisc.pas	Thu Dec 24 02:02:12 2009 +0000
+++ b/hedgewars/uMisc.pas	Thu Dec 24 13:38:20 2009 +0000
@@ -169,8 +169,9 @@
 function  Surface2Tex(surf: PSDL_Surface; enableClamp: boolean): PTexture;
 procedure FreeTexture(tex: PTexture);
 function  toPowerOf2(i: Longword): Longword;
-function DecodeBase64(s: shortstring): shortstring;
-function doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface;
+function  DecodeBase64(s: shortstring): shortstring;
+function  doSurfaceConversion(tmpsurf: PSDL_Surface): PSDL_Surface;
+function  endian(independent: LongWord): LongWord;
 {$IFNDEF IPHONEOS}
 procedure MakeScreenshot(s: shortstring);
 {$ENDIF}
@@ -560,6 +561,17 @@
 	else doSurfaceConversion:= tmpsurf;
 end;
 
+function endian(independent: LongWord): LongWord;
+begin
+{$IFDEF ENDIAN_LITTLE}
+endian:= independent;
+{$ELSE}
+endian:= (((independent and $FF000000) shr 24) or
+	  ((independent and $00FF0000) shr 8) or
+	  ((independent and $0000FF00) shl 8) or
+	  ((independent and $000000FF) shl 24))
+{$ENDIF}
+end;
 
 initialization
 cDrownSpeed.QWordValue:= 257698038;// 0.06