Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: third_party/lzma_sdk/Bra86.c

Issue 10152012: Second attempt to update lzma_sdk to 9.20 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/lzma_sdk/Bra.c ('k') | third_party/lzma_sdk/Compress/Branch/BranchTypes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/lzma_sdk/Bra86.c
diff --git a/third_party/lzma_sdk/Compress/Branch/BranchX86.c b/third_party/lzma_sdk/Bra86.c
similarity index 75%
rename from third_party/lzma_sdk/Compress/Branch/BranchX86.c
rename to third_party/lzma_sdk/Bra86.c
index fd1d334ecf45ef37c41206729866bb647b761198..1ee0e709b88771b7f00662fa77fad886a1a72343 100644
--- a/third_party/lzma_sdk/Compress/Branch/BranchX86.c
+++ b/third_party/lzma_sdk/Bra86.c
@@ -1,29 +1,30 @@
-/* BranchX86.c */
+/* Bra86.c -- Converter for x86 code (BCJ)
+2008-10-04 : Igor Pavlov : Public domain */
-#include "BranchX86.h"
+#include "Bra.h"
#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF)
const Byte kMaskToAllowedStatus[8] = {1, 1, 1, 0, 1, 0, 0, 0};
const Byte kMaskToBitNumber[8] = {0, 1, 2, 2, 3, 3, 3, 3};
-SizeT x86_Convert(Byte *buffer, SizeT endPos, UInt32 nowPos, UInt32 *prevMaskMix, int encoding)
+SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding)
{
SizeT bufferPos = 0, prevPosT;
- UInt32 prevMask = *prevMaskMix & 0x7;
- if (endPos < 5)
+ UInt32 prevMask = *state & 0x7;
+ if (size < 5)
return 0;
- nowPos += 5;
+ ip += 5;
prevPosT = (SizeT)0 - 1;
- for(;;)
+ for (;;)
{
- Byte *p = buffer + bufferPos;
- Byte *limit = buffer + endPos - 4;
+ Byte *p = data + bufferPos;
+ Byte *limit = data + size - 4;
for (; p < limit; p++)
if ((*p & 0xFE) == 0xE8)
break;
- bufferPos = (SizeT)(p - buffer);
+ bufferPos = (SizeT)(p - data);
if (p >= limit)
break;
prevPosT = bufferPos - prevPosT;
@@ -55,9 +56,9 @@ SizeT x86_Convert(Byte *buffer, SizeT endPos, UInt32 nowPos, UInt32 *prevMaskMix
Byte b;
int index;
if (encoding)
- dest = (nowPos + (UInt32)bufferPos) + src;
+ dest = (ip + (UInt32)bufferPos) + src;
else
- dest = src - (nowPos + (UInt32)bufferPos);
+ dest = src - (ip + (UInt32)bufferPos);
if (prevMask == 0)
break;
index = kMaskToBitNumber[prevMask] * 8;
@@ -79,6 +80,6 @@ SizeT x86_Convert(Byte *buffer, SizeT endPos, UInt32 nowPos, UInt32 *prevMaskMix
}
}
prevPosT = bufferPos - prevPosT;
- *prevMaskMix = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7));
+ *state = ((prevPosT > 3) ? 0 : ((prevMask << ((int)prevPosT - 1)) & 0x7));
return bufferPos;
}
« no previous file with comments | « third_party/lzma_sdk/Bra.c ('k') | third_party/lzma_sdk/Compress/Branch/BranchTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698