mirror of
https://github.com/aaru-dps/Aaru.Helpers.git
synced 2025-12-16 19:24:35 +00:00
Refactor and code cleanup.
This commit is contained in:
@@ -33,14 +33,14 @@ namespace DiscImageChef
|
|||||||
public static void ArrayFill<T>(T[] destinationArray, T value)
|
public static void ArrayFill<T>(T[] destinationArray, T value)
|
||||||
{
|
{
|
||||||
// if called with a single value, wrap the value in an array and call the main function
|
// if called with a single value, wrap the value in an array and call the main function
|
||||||
ArrayFill<T>(destinationArray, new T[] { value });
|
ArrayFill(destinationArray, new T[] { value });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ArrayFill<T>(T[] destinationArray, T[] value)
|
public static void ArrayFill<T>(T[] destinationArray, T[] value)
|
||||||
{
|
{
|
||||||
if(destinationArray == null)
|
if(destinationArray == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("destinationArray");
|
throw new ArgumentNullException(nameof(destinationArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(value.Length > destinationArray.Length)
|
if(value.Length > destinationArray.Length)
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
// Copyright © 2011-2016 Natalia Portillo
|
// Copyright © 2011-2016 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace DiscImageChef
|
namespace DiscImageChef
|
||||||
{
|
{
|
||||||
public static partial class ArrayHelpers
|
public static partial class ArrayHelpers
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ namespace DiscImageChef
|
|||||||
///</summary>
|
///</summary>
|
||||||
public static short ToInt16(byte[] value, int startIndex)
|
public static short ToInt16(byte[] value, int startIndex)
|
||||||
{
|
{
|
||||||
return !IsLittleEndian ? BitConverter.ToInt16(value, startIndex) : BitConverter.ToInt16(value.Reverse().ToArray(), value.Length - sizeof(Int16) - startIndex);
|
return !IsLittleEndian ? BitConverter.ToInt16(value, startIndex) : BitConverter.ToInt16(value.Reverse().ToArray(), value.Length - sizeof(short) - startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -393,7 +393,7 @@ namespace DiscImageChef
|
|||||||
///</summary>
|
///</summary>
|
||||||
public static int ToInt32(byte[] value, int startIndex)
|
public static int ToInt32(byte[] value, int startIndex)
|
||||||
{
|
{
|
||||||
return !IsLittleEndian ? BitConverter.ToInt32(value, startIndex) : BitConverter.ToInt32(value.Reverse().ToArray(), value.Length - sizeof(Int32) - startIndex);
|
return !IsLittleEndian ? BitConverter.ToInt32(value, startIndex) : BitConverter.ToInt32(value.Reverse().ToArray(), value.Length - sizeof(int) - startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -424,7 +424,7 @@ namespace DiscImageChef
|
|||||||
///</summary>
|
///</summary>
|
||||||
public static long ToInt64(byte[] value, int startIndex)
|
public static long ToInt64(byte[] value, int startIndex)
|
||||||
{
|
{
|
||||||
return !IsLittleEndian ? BitConverter.ToInt64(value, startIndex) : BitConverter.ToInt64(value.Reverse().ToArray(), value.Length - sizeof(Int64) - startIndex);
|
return !IsLittleEndian ? BitConverter.ToInt64(value, startIndex) : BitConverter.ToInt64(value.Reverse().ToArray(), value.Length - sizeof(long) - startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -456,7 +456,7 @@ namespace DiscImageChef
|
|||||||
///</summary>
|
///</summary>
|
||||||
public static float ToSingle(byte[] value, int startIndex)
|
public static float ToSingle(byte[] value, int startIndex)
|
||||||
{
|
{
|
||||||
return !IsLittleEndian ? BitConverter.ToSingle(value, startIndex) : BitConverter.ToSingle(value.Reverse().ToArray(), value.Length - sizeof(Single) - startIndex);
|
return !IsLittleEndian ? BitConverter.ToSingle(value, startIndex) : BitConverter.ToSingle(value.Reverse().ToArray(), value.Length - sizeof(float) - startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -575,7 +575,7 @@ namespace DiscImageChef
|
|||||||
///</summary>
|
///</summary>
|
||||||
public static ushort ToUInt16(byte[] value, int startIndex)
|
public static ushort ToUInt16(byte[] value, int startIndex)
|
||||||
{
|
{
|
||||||
return !IsLittleEndian ? BitConverter.ToUInt16(value, startIndex) : BitConverter.ToUInt16(value.Reverse().ToArray(), value.Length - sizeof(UInt16) - startIndex);
|
return !IsLittleEndian ? BitConverter.ToUInt16(value, startIndex) : BitConverter.ToUInt16(value.Reverse().ToArray(), value.Length - sizeof(ushort) - startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -606,7 +606,7 @@ namespace DiscImageChef
|
|||||||
///</summary>
|
///</summary>
|
||||||
public static uint ToUInt32(byte[] value, int startIndex)
|
public static uint ToUInt32(byte[] value, int startIndex)
|
||||||
{
|
{
|
||||||
return !IsLittleEndian ? BitConverter.ToUInt32(value, startIndex) : BitConverter.ToUInt32(value.Reverse().ToArray(), value.Length - sizeof(UInt32) - startIndex);
|
return !IsLittleEndian ? BitConverter.ToUInt32(value, startIndex) : BitConverter.ToUInt32(value.Reverse().ToArray(), value.Length - sizeof(uint) - startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -637,14 +637,14 @@ namespace DiscImageChef
|
|||||||
///</summary>
|
///</summary>
|
||||||
public static ulong ToUInt64(byte[] value, int startIndex)
|
public static ulong ToUInt64(byte[] value, int startIndex)
|
||||||
{
|
{
|
||||||
return !IsLittleEndian ? BitConverter.ToUInt64(value, startIndex) : BitConverter.ToUInt64(value.Reverse().ToArray(), value.Length - sizeof(UInt64) - startIndex);
|
return !IsLittleEndian ? BitConverter.ToUInt64(value, startIndex) : BitConverter.ToUInt64(value.Reverse().ToArray(), value.Length - sizeof(ulong) - startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Guid ToGuid(byte[] value, int startIndex)
|
public static Guid ToGuid(byte[] value, int startIndex)
|
||||||
{
|
{
|
||||||
return new Guid(BigEndianBitConverter.ToUInt32(value, 0 + startIndex),
|
return new Guid(ToUInt32(value, 0 + startIndex),
|
||||||
BigEndianBitConverter.ToUInt16(value, 4 + startIndex),
|
ToUInt16(value, 4 + startIndex),
|
||||||
BigEndianBitConverter.ToUInt16(value, 6 + startIndex),
|
ToUInt16(value, 6 + startIndex),
|
||||||
value[8 + startIndex + 0], value[8 + startIndex + 1],
|
value[8 + startIndex + 0], value[8 + startIndex + 1],
|
||||||
value[8 + startIndex + 2], value[8 + startIndex + 3],
|
value[8 + startIndex + 2], value[8 + startIndex + 3],
|
||||||
value[8 + startIndex + 5], value[8 + startIndex + 5],
|
value[8 + startIndex + 5], value[8 + startIndex + 5],
|
||||||
|
|||||||
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
|||||||
|
2016-07-28 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
|
* Swapping.cs:
|
||||||
|
* PrintHex.cs:
|
||||||
|
* ArrayFill.cs:
|
||||||
|
* ArrayIsEmpty.cs:
|
||||||
|
* DateHandlers.cs:
|
||||||
|
* StringHandlers.cs:
|
||||||
|
* BigEndianBitConverter.cs:
|
||||||
|
* EndianAwareBinaryReader.cs: Refactor and code cleanup.
|
||||||
|
|
||||||
2016-01-13 Natalia Portillo <claunia@claunia.com>
|
2016-01-13 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* ArrayFill.cs:
|
* ArrayFill.cs:
|
||||||
|
|||||||
@@ -49,17 +49,17 @@ namespace DiscImageChef
|
|||||||
return MacEpoch.AddTicks((long)(MacTimeStamp * 10000000));
|
return MacEpoch.AddTicks((long)(MacTimeStamp * 10000000));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime LisaToDateTime(UInt32 LisaTimeStamp)
|
public static DateTime LisaToDateTime(uint LisaTimeStamp)
|
||||||
{
|
{
|
||||||
return LisaEpoch.AddSeconds(LisaTimeStamp);
|
return LisaEpoch.AddSeconds(LisaTimeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime UNIXToDateTime(Int32 UNIXTimeStamp)
|
public static DateTime UNIXToDateTime(int UNIXTimeStamp)
|
||||||
{
|
{
|
||||||
return UNIXEpoch.AddSeconds(UNIXTimeStamp);
|
return UNIXEpoch.AddSeconds(UNIXTimeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime UNIXUnsignedToDateTime(UInt32 UNIXTimeStamp)
|
public static DateTime UNIXUnsignedToDateTime(uint UNIXTimeStamp)
|
||||||
{
|
{
|
||||||
return UNIXEpoch.AddSeconds(UNIXTimeStamp);
|
return UNIXEpoch.AddSeconds(UNIXTimeStamp);
|
||||||
}
|
}
|
||||||
@@ -75,49 +75,49 @@ namespace DiscImageChef
|
|||||||
fourcharvalue[2] = VDDateTime[2];
|
fourcharvalue[2] = VDDateTime[2];
|
||||||
fourcharvalue[3] = VDDateTime[3];
|
fourcharvalue[3] = VDDateTime[3];
|
||||||
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "year = \"{0}\"", StringHandlers.CToString(fourcharvalue));
|
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "year = \"{0}\"", StringHandlers.CToString(fourcharvalue));
|
||||||
if(!Int32.TryParse(StringHandlers.CToString(fourcharvalue), out year))
|
if(!int.TryParse(StringHandlers.CToString(fourcharvalue), out year))
|
||||||
year = 0;
|
year = 0;
|
||||||
// year = Convert.ToInt32(StringHandlers.CToString(fourcharvalue));
|
// year = Convert.ToInt32(StringHandlers.CToString(fourcharvalue));
|
||||||
|
|
||||||
twocharvalue[0] = VDDateTime[4];
|
twocharvalue[0] = VDDateTime[4];
|
||||||
twocharvalue[1] = VDDateTime[5];
|
twocharvalue[1] = VDDateTime[5];
|
||||||
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "month = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "month = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
||||||
if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out month))
|
if(!int.TryParse(StringHandlers.CToString(twocharvalue), out month))
|
||||||
month = 0;
|
month = 0;
|
||||||
// month = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
// month = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
||||||
|
|
||||||
twocharvalue[0] = VDDateTime[6];
|
twocharvalue[0] = VDDateTime[6];
|
||||||
twocharvalue[1] = VDDateTime[7];
|
twocharvalue[1] = VDDateTime[7];
|
||||||
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "day = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "day = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
||||||
if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out day))
|
if(!int.TryParse(StringHandlers.CToString(twocharvalue), out day))
|
||||||
day = 0;
|
day = 0;
|
||||||
// day = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
// day = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
||||||
|
|
||||||
twocharvalue[0] = VDDateTime[8];
|
twocharvalue[0] = VDDateTime[8];
|
||||||
twocharvalue[1] = VDDateTime[9];
|
twocharvalue[1] = VDDateTime[9];
|
||||||
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hour = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hour = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
||||||
if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out hour))
|
if(!int.TryParse(StringHandlers.CToString(twocharvalue), out hour))
|
||||||
hour = 0;
|
hour = 0;
|
||||||
// hour = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
// hour = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
||||||
|
|
||||||
twocharvalue[0] = VDDateTime[10];
|
twocharvalue[0] = VDDateTime[10];
|
||||||
twocharvalue[1] = VDDateTime[11];
|
twocharvalue[1] = VDDateTime[11];
|
||||||
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "minute = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "minute = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
||||||
if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out minute))
|
if(!int.TryParse(StringHandlers.CToString(twocharvalue), out minute))
|
||||||
minute = 0;
|
minute = 0;
|
||||||
// minute = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
// minute = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
||||||
|
|
||||||
twocharvalue[0] = VDDateTime[12];
|
twocharvalue[0] = VDDateTime[12];
|
||||||
twocharvalue[1] = VDDateTime[13];
|
twocharvalue[1] = VDDateTime[13];
|
||||||
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "second = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "second = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
||||||
if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out second))
|
if(!int.TryParse(StringHandlers.CToString(twocharvalue), out second))
|
||||||
second = 0;
|
second = 0;
|
||||||
// second = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
// second = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
||||||
|
|
||||||
twocharvalue[0] = VDDateTime[14];
|
twocharvalue[0] = VDDateTime[14];
|
||||||
twocharvalue[1] = VDDateTime[15];
|
twocharvalue[1] = VDDateTime[15];
|
||||||
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hundredths = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
DicConsole.DebugWriteLine("ISO9600ToDateTime handler", "hundredths = \"{0}\"", StringHandlers.CToString(twocharvalue));
|
||||||
if(!Int32.TryParse(StringHandlers.CToString(twocharvalue), out hundredths))
|
if(!int.TryParse(StringHandlers.CToString(twocharvalue), out hundredths))
|
||||||
hundredths = 0;
|
hundredths = 0;
|
||||||
// hundredths = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
// hundredths = Convert.ToInt32(StringHandlers.CToString(twocharvalue));
|
||||||
|
|
||||||
@@ -128,13 +128,13 @@ namespace DiscImageChef
|
|||||||
}
|
}
|
||||||
|
|
||||||
// C# works in UTC, VMS on Julian Date, some displacement may occur on disks created outside UTC
|
// C# works in UTC, VMS on Julian Date, some displacement may occur on disks created outside UTC
|
||||||
public static DateTime VMSToDateTime(UInt64 vmsDate)
|
public static DateTime VMSToDateTime(ulong vmsDate)
|
||||||
{
|
{
|
||||||
double delta = vmsDate * 0.0001; // Tenths of microseconds to milliseconds, will lose some detail
|
double delta = vmsDate * 0.0001; // Tenths of microseconds to milliseconds, will lose some detail
|
||||||
return JulianEpoch.AddMilliseconds(delta);
|
return JulianEpoch.AddMilliseconds(delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DateTime AmigaToDateTime(UInt32 days, UInt32 minutes, UInt32 ticks)
|
public static DateTime AmigaToDateTime(uint days, uint minutes, uint ticks)
|
||||||
{
|
{
|
||||||
DateTime temp = AmigaEpoch.AddDays(days);
|
DateTime temp = AmigaEpoch.AddDays(days);
|
||||||
temp = temp.AddMinutes(minutes);
|
temp = temp.AddMinutes(minutes);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace DiscImageChef
|
|||||||
{
|
{
|
||||||
public class EndianAwareBinaryReader : BinaryReader
|
public class EndianAwareBinaryReader : BinaryReader
|
||||||
{
|
{
|
||||||
byte[] buffer = new byte[8];
|
readonly byte[] buffer = new byte[8];
|
||||||
|
|
||||||
public EndianAwareBinaryReader(Stream input, Encoding encoding, bool isLittleEndian)
|
public EndianAwareBinaryReader(Stream input, Encoding encoding, bool isLittleEndian)
|
||||||
: base(input, encoding)
|
: base(input, encoding)
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
// Copyright © 2011-2016 Natalia Portillo
|
// Copyright © 2011-2016 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
|
||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
|
|
||||||
namespace DiscImageChef
|
namespace DiscImageChef
|
||||||
|
|||||||
@@ -1,42 +1,35 @@
|
|||||||
/***************************************************************************
|
// /***************************************************************************
|
||||||
The Disc Image Chef
|
// The Disc Image Chef
|
||||||
----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
Filename : StringHandlers.cs
|
// Filename : StringHandlers.cs
|
||||||
Version : 1.0
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
Author(s) : Natalia Portillo
|
//
|
||||||
|
// Component : Helpers.
|
||||||
Component : Program tools
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Convert byte arrays to C# strings.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful, but
|
||||||
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2011-2016 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
|
||||||
Revision : $Revision$
|
|
||||||
Last change by : $Author$
|
|
||||||
Date : $Date$
|
|
||||||
|
|
||||||
--[ Description ] ----------------------------------------------------------
|
|
||||||
|
|
||||||
Convert byte arrays to C# strings.
|
|
||||||
|
|
||||||
--[ License ] --------------------------------------------------------------
|
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2.1 of the
|
|
||||||
License, or(at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
----------------------------------------------------------------------------
|
|
||||||
Copyright (C) 2011-2014 Claunia.com
|
|
||||||
****************************************************************************/
|
|
||||||
//$Id$
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace DiscImageChef
|
namespace DiscImageChef
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
// Copyright © 2011-2016 Natalia Portillo
|
// Copyright © 2011-2016 Natalia Portillo
|
||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace DiscImageChef
|
namespace DiscImageChef
|
||||||
{
|
{
|
||||||
public static class Swapping
|
public static class Swapping
|
||||||
@@ -92,12 +90,12 @@ namespace DiscImageChef
|
|||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UInt32 PDPFromLittleEndian(UInt32 x)
|
public static uint PDPFromLittleEndian(uint x)
|
||||||
{
|
{
|
||||||
return ((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16);
|
return ((x & 0xffff) << 16) | ((x & 0xffff0000) >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UInt32 PDPFromBigEndian(UInt32 x)
|
public static uint PDPFromBigEndian(uint x)
|
||||||
{
|
{
|
||||||
return ((x & 0xff00ff) << 8) | ((x & 0xff00ff00) >> 8);
|
return ((x & 0xff00ff) << 8) | ((x & 0xff00ff00) >> 8);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user