Permalink
Browse files

Unroll alphaMask deserialization loop

  • Loading branch information...
1 parent dcaca6e commit f3f832a629aa03e06477c210c47c92dee1cb8e5c @nfurtwangler nfurtwangler committed Feb 19, 2013
Showing with 6 additions and 6 deletions.
  1. +6 −6 MonoGame.Framework/Graphics/DxtUtil.cs
@@ -339,12 +339,12 @@ private static void DecompressDxt5Block(BinaryReader imageReader, int x, int y,
byte alpha0 = imageReader.ReadByte();
byte alpha1 = imageReader.ReadByte();
- ulong alphaMask = 0;
-
- for (int i = 0; i < 6; i++)
- {
- alphaMask += ((ulong)imageReader.ReadByte()) << i * 8;
- }
+ ulong alphaMask = (ulong)imageReader.ReadByte();
+ alphaMask += (ulong)imageReader.ReadByte() << 8;
+ alphaMask += (ulong)imageReader.ReadByte() << 16;
+ alphaMask += (ulong)imageReader.ReadByte() << 24;
+ alphaMask += (ulong)imageReader.ReadByte() << 32;
+ alphaMask += (ulong)imageReader.ReadByte() << 40;
ushort c0 = imageReader.ReadUInt16();
ushort c1 = imageReader.ReadUInt16();

0 comments on commit f3f832a

Please sign in to comment.