mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-27 06:50:23 +00:00
20 lines
471 B
C#
20 lines
471 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Switch_Toolbox.Library.IO
|
|||
|
{
|
|||
|
public static class IOExtensions
|
|||
|
{
|
|||
|
public static uint Reverse(this uint x)
|
|||
|
{
|
|||
|
// swap adjacent 16-bit blocks
|
|||
|
x = (x >> 16) | (x << 16);
|
|||
|
// swap adjacent 8-bit blocks
|
|||
|
return ((x & 0xFF00FF00) >> 8) | ((x & 0x00FF00FF) << 8);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|