1
0
mirror of synced 2024-12-04 20:08:00 +01:00
Switch-Toolbox/Switch_Toolbox_Library/IO/Bits/Bit.cs
KillzXGaming f92195e8e1 Add wip bflyt saving.
Todo prts,usd, and bnd1 section is needed however
2019-09-01 13:02:48 -04:00

23 lines
587 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Toolbox.Library.IO
{
class Bit
{
//From https://github.com/shibbo/flyte/blob/337383c01c50dff155e4b4e170d248118db0c0aa/flyte/utils/Bit.cs
public static uint ExtractBits(uint val, int numBits, int startBit)
{
uint mask = 0;
for (int i = startBit; i < startBit + numBits; i++)
mask |= (0x80000000 >> i);
return (val & mask) >> (32 - (startBit + numBits));
}
}
}