mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-11 04:29:15 +08:00
added 'padd' MMX instructions emulation.
This commit is contained in:
parent
d1fa630f3d
commit
9e5990b118
@ -405,6 +405,30 @@ namespace GameRes.Formats
|
||||
}
|
||||
}
|
||||
|
||||
public static class MMX
|
||||
{
|
||||
public static ulong PAddW (ulong x, ulong y)
|
||||
{
|
||||
ulong mask = 0xffff;
|
||||
ulong r = ((x & mask) + (y & mask)) & mask;
|
||||
mask <<= 16;
|
||||
r |= ((x & mask) + (y & mask)) & mask;
|
||||
mask <<= 16;
|
||||
r |= ((x & mask) + (y & mask)) & mask;
|
||||
mask <<= 16;
|
||||
r |= ((x & mask) + (y & mask)) & mask;
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ulong PAddD (ulong x, ulong y)
|
||||
{
|
||||
ulong mask = 0xffffffff;
|
||||
ulong r = ((x & mask) + (y & mask)) & mask;
|
||||
mask <<= 32;
|
||||
return r | ((x & mask) + (y & mask)) & mask;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Dump
|
||||
{
|
||||
public static string DirectoryName = Environment.GetFolderPath (Environment.SpecialFolder.UserProfile);
|
||||
|
@ -201,7 +201,7 @@ namespace GameRes.Formats.Neko
|
||||
while (first != last)
|
||||
{
|
||||
ulong v = *first ^ key;
|
||||
key = _m_paddw (key, v);
|
||||
key = MMX.PAddW (key, v);
|
||||
*first++ = v;
|
||||
}
|
||||
return key;
|
||||
@ -209,19 +209,6 @@ namespace GameRes.Formats.Neko
|
||||
}
|
||||
}
|
||||
|
||||
static ulong _m_paddw (ulong x, ulong y)
|
||||
{
|
||||
ulong mask = 0xffff;
|
||||
ulong r = ((x & mask) + (y & mask)) & mask;
|
||||
mask <<= 16;
|
||||
r |= ((x & mask) + (y & mask)) & mask;
|
||||
mask <<= 16;
|
||||
r |= ((x & mask) + (y & mask)) & mask;
|
||||
mask <<= 16;
|
||||
r |= ((x & mask) + (y & mask)) & mask;
|
||||
return r;
|
||||
}
|
||||
|
||||
static byte[] ReadBlock (ArcView.Frame view, uint id, long offset, out int length)
|
||||
{
|
||||
uint hash = view.ReadUInt32 (offset);
|
||||
|
Loading…
x
Reference in New Issue
Block a user