From a4311a0f2ab5f7507568544ffe748e3672039427 Mon Sep 17 00:00:00 2001 From: morkt Date: Mon, 3 Oct 2016 23:23:43 +0400 Subject: [PATCH] (Binary.BigEndian): simplified. --- GameRes/Utility.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GameRes/Utility.cs b/GameRes/Utility.cs index 4654f7a6..594fc7a3 100644 --- a/GameRes/Utility.cs +++ b/GameRes/Utility.cs @@ -31,7 +31,7 @@ namespace GameRes.Utility { public static uint BigEndian (uint u) { - return (u & 0xff) << 24 | (u & 0xff00) << 8 | (u & 0xff0000) >> 8 | (u & 0xff000000) >> 24; + return u << 24 | (u & 0xff00) << 8 | (u & 0xff0000) >> 8 | u >> 24; } public static int BigEndian (int i) { @@ -39,7 +39,7 @@ namespace GameRes.Utility } public static ushort BigEndian (ushort u) { - return (ushort)((u & 0xff) << 8 | (u & 0xff00) >> 8); + return (ushort)(u << 8 | u >> 8); } public static short BigEndian (short i) {