Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'C/Compress/Branch')
-rwxr-xr-xC/Compress/Branch/BranchARM.c2
-rwxr-xr-xC/Compress/Branch/BranchARMThumb.c2
-rwxr-xr-xC/Compress/Branch/BranchIA64.c29
-rwxr-xr-xC/Compress/Branch/BranchSPARC.c2
-rwxr-xr-xC/Compress/Branch/BranchSPARC.h2
-rwxr-xr-xC/Compress/Branch/BranchTypes.h13
6 files changed, 33 insertions, 17 deletions
diff --git a/C/Compress/Branch/BranchARM.c b/C/Compress/Branch/BranchARM.c
index 6d4e3672..da7db261 100755
--- a/C/Compress/Branch/BranchARM.c
+++ b/C/Compress/Branch/BranchARM.c
@@ -9,9 +9,9 @@ UInt32 ARM_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
{
if (data[i + 3] == 0xEB)
{
+ UInt32 dest;
UInt32 src = (data[i + 2] << 16) | (data[i + 1] << 8) | (data[i + 0]);
src <<= 2;
- UInt32 dest;
if (encoding)
dest = nowPos + i + 8 + src;
else
diff --git a/C/Compress/Branch/BranchARMThumb.c b/C/Compress/Branch/BranchARMThumb.c
index aab9c7a1..fa30e439 100755
--- a/C/Compress/Branch/BranchARMThumb.c
+++ b/C/Compress/Branch/BranchARMThumb.c
@@ -10,6 +10,7 @@ UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
if ((data[i + 1] & 0xF8) == 0xF0 &&
(data[i + 3] & 0xF8) == 0xF8)
{
+ UInt32 dest;
UInt32 src =
((data[i + 1] & 0x7) << 19) |
(data[i + 0] << 11) |
@@ -17,7 +18,6 @@ UInt32 ARMThumb_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
(data[i + 2]);
src <<= 1;
- UInt32 dest;
if (encoding)
dest = nowPos + i + 4 + src;
else
diff --git a/C/Compress/Branch/BranchIA64.c b/C/Compress/Branch/BranchIA64.c
index e7775564..009086b1 100755
--- a/C/Compress/Branch/BranchIA64.c
+++ b/C/Compress/Branch/BranchIA64.c
@@ -18,29 +18,32 @@ UInt32 IA64_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
UInt32 instrTemplate = data[i] & 0x1F;
UInt32 mask = kBranchTable[instrTemplate];
UInt32 bitPos = 5;
- for (int slot = 0; slot < 3; slot++, bitPos += 41)
+ int slot;
+ for (slot = 0; slot < 3; slot++, bitPos += 41)
{
+ UInt32 bytePos, bitRes;
+ UInt64 instruction, instNorm;
+ int j;
if (((mask >> slot) & 1) == 0)
continue;
- UInt32 bytePos = (bitPos >> 3);
- UInt32 bitRes = bitPos & 0x7;
- UInt64 instruction = 0;
- int j;
+ bytePos = (bitPos >> 3);
+ bitRes = bitPos & 0x7;
+ instruction = 0;
for (j = 0; j < 6; j++)
instruction += (UInt64)(data[i + j + bytePos]) << (8 * j);
- UInt64 instNorm = instruction >> bitRes;
+ instNorm = instruction >> bitRes;
if (((instNorm >> 37) & 0xF) == 0x5
&& ((instNorm >> 9) & 0x7) == 0
/* && (instNorm & 0x3F)== 0 */
)
{
- UInt32 src = UInt32((instNorm >> 13) & 0xFFFFF);
- src |= ((instNorm >> 36) & 1) << 20;
+ UInt32 src = (UInt32)((instNorm >> 13) & 0xFFFFF);
+ UInt32 dest;
+ src |= ((UInt32)(instNorm >> 36) & 1) << 20;
src <<= 4;
- UInt32 dest;
if (encoding)
dest = nowPos + i + src;
else
@@ -48,14 +51,14 @@ UInt32 IA64_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
dest >>= 4;
- instNorm &= ~(UInt64(0x8FFFFF) << 13);
- instNorm |= (UInt64(dest & 0xFFFFF) << 13);
- instNorm |= (UInt64(dest & 0x100000) << (36 - 20));
+ instNorm &= ~((UInt64)(0x8FFFFF) << 13);
+ instNorm |= ((UInt64)(dest & 0xFFFFF) << 13);
+ instNorm |= ((UInt64)(dest & 0x100000) << (36 - 20));
instruction &= (1 << bitRes) - 1;
instruction |= (instNorm << bitRes);
for (j = 0; j < 6; j++)
- data[i + j + bytePos] = Byte(instruction >> (8 * j));
+ data[i + j + bytePos] = (Byte)(instruction >> (8 * j));
}
}
}
diff --git a/C/Compress/Branch/BranchSPARC.c b/C/Compress/Branch/BranchSPARC.c
index c175875b..79da2ea7 100755
--- a/C/Compress/Branch/BranchSPARC.c
+++ b/C/Compress/Branch/BranchSPARC.c
@@ -15,9 +15,9 @@ UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding)
((UInt32)data[i + 1] << 16) |
((UInt32)data[i + 2] << 8) |
((UInt32)data[i + 3]);
+ UInt32 dest;
src <<= 2;
- UInt32 dest;
if (encoding)
dest = nowPos + i + src;
else
diff --git a/C/Compress/Branch/BranchSPARC.h b/C/Compress/Branch/BranchSPARC.h
index fbe9e673..67f44411 100755
--- a/C/Compress/Branch/BranchSPARC.h
+++ b/C/Compress/Branch/BranchSPARC.h
@@ -5,6 +5,6 @@
#include "BranchTypes.h"
-UInt32 SPARC_B_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
+UInt32 SPARC_Convert(Byte *data, UInt32 size, UInt32 nowPos, int encoding);
#endif
diff --git a/C/Compress/Branch/BranchTypes.h b/C/Compress/Branch/BranchTypes.h
index f7ad3abc..bdf75131 100755
--- a/C/Compress/Branch/BranchTypes.h
+++ b/C/Compress/Branch/BranchTypes.h
@@ -22,4 +22,17 @@ typedef unsigned int UInt32;
#endif
#endif
+#ifndef _7ZIP_UINT64_DEFINED
+#define _7ZIP_UINT64_DEFINED
+#ifdef _SZ_NO_INT_64
+typedef unsigned long UInt64;
+#else
+#ifdef _MSC_VER
+typedef unsigned __int64 UInt64;
+#else
+typedef unsigned long long int UInt64;
+#endif
+#endif
+#endif
+
#endif