Skip Menu |

This queue is for tickets about the Compress-LZ4 CPAN distribution.

Report information
The Basics
Id: 83876
Status: rejected
Priority: 0/
Queue: Compress-LZ4

People
Owner: Nobody in particular
Requestors: almog [...] infoneto.co.il
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Does not support Visual C++ 6.0, patch attached to fix
Date: Mon, 11 Mar 2013 10:27:41 +0200
To: bug-Compress-LZ4 [...] rt.cpan.org
From: "Roey Almog (Infoneto Ltd)" <almog [...] infoneto.co.il>
Hi, Due to missing BitScanForward/Reverse on visual C++ 6.0 code is not compiling. I added a patched so the BitScan fiction are used from Visual C++ 2005 and above while using default method for the older versions: two files need the patch: --- lz4hc.c (revision 9373) +++ lz4hc.c (revision 9392) @@ -215,7 +215,7 @@ inline static int LZ4_NbCommonBytes (register U64 val) { #if defined(LZ4_BIG_ENDIAN) - #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) + #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanReverse64( &r, val ); return (int)(r>>3); @@ -229,7 +229,7 @@ return r; #endif #else - #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) + #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanForward64( &r, val ); return (int)(r>>3); @@ -247,7 +247,7 @@ inline static int LZ4_NbCommonBytes (register U32 val) { #if defined(LZ4_BIG_ENDIAN) - #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) + #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanReverse( &r, val ); return (int)(r>>3); @@ -260,7 +260,7 @@ return r; #endif #else - #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) + #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanForward( &r, val ); return (int)(r>>3); --- lz4c.c (revision 9373) +++ lz4c.c (revision 9392) @@ -101,13 +101,15 @@ #ifdef _MSC_VER // Visual Studio # define inline __forceinline // Visual is not C99, but supports some kind of inline -# include <intrin.h> // For Visual 2005 -# if LZ4_ARCH64 // 64-bit -# pragma intrinsic(_BitScanForward64) // For Visual 2005 -# pragma intrinsic(_BitScanReverse64) // For Visual 2005 -# else -# pragma intrinsic(_BitScanForward) // For Visual 2005 -# pragma intrinsic(_BitScanReverse) // For Visual 2005 +# if _MSC_VER >= 1400 +# include <intrin.h> // For Visual 2005 +# if LZ4_ARCH64 // 64-bit +# pragma intrinsic(_BitScanForward64) // For Visual 2005 +# pragma intrinsic(_BitScanReverse64) // For Visual 2005 +# else +# pragma intrinsic(_BitScanForward) // For Visual 2005 +# pragma intrinsic(_BitScanReverse) // For Visual 2005 +# endif # endif #endif @@ -254,7 +256,7 @@ static inline int LZ4_NbCommonBytes (register U64 val) { #if defined(LZ4_BIG_ENDIAN) - #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) + #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanReverse64( &r, val ); return (int)(r>>3); @@ -268,7 +270,7 @@ return r; #endif #else - #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) + #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanForward64( &r, val ); return (int)(r>>3); @@ -286,7 +288,7 @@ static inline int LZ4_NbCommonBytes (register U32 val) { #if defined(LZ4_BIG_ENDIAN) - #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) + #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanReverse( &r, val ); return (int)(r>>3); @@ -299,7 +301,7 @@ return r; #endif #else - #if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT) + #if defined(_MSC_VER) && _MSC_VER >= 1400 && !defined(LZ4_FORCE_SW_BITCOUNT) unsigned long r = 0; _BitScanForward( &r, val ); return (int)(r>>3);
On Mon Mar 11 04:27:52 2013, almog@infoneto.co.il wrote: Show quoted text
> Due to missing BitScanForward/Reverse on visual C++ 6.0 code is not > compiling. > > I added a patched so the BitScan fiction are used from Visual C++ 2005 and > above while using default method for the older versions: > two files need the patch:
I don't maintain the lz4 library code. Please report this upstream and once it is accepted there, I will pull it in here. Thanks
On Mon Mar 11 10:02:52 2013, GRAY wrote: Show quoted text
> On Mon Mar 11 04:27:52 2013, almog@infoneto.co.il wrote: >
> > Due to missing BitScanForward/Reverse on visual C++ 6.0 code is not > > compiling. > > > > I added a patched so the BitScan fiction are used from Visual C++
2005 and Show quoted text
> > above while using default method for the older versions: > > two files need the patch:
> > I don't maintain the lz4 library code. Please report this upstream and > once it is accepted there, I will pull it in here. > > Thanks
I see there are some new portability fixes in the lz4 codebase and I'll be integrating those today. I don't know if any of those address your problem, but I didn't see you create a ticket on the lz4 tracker, so I'm going to close this ticket.