From f1750f7905351076d9334975f01f44934262554b Mon Sep 17 00:00:00 2001 From: Marc Lehmann Date: Tue, 1 Jun 2010 01:15:34 +0000 Subject: *** empty log message *** --- Changes | 1 + bench.c | 4 +--- lzfP.h | 27 ++++++++++++++------------- lzf_d.c | 2 -- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/Changes b/Changes index 46da03e..99c0405 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ greatly speeding up decompression in most cases. - finally disable rep movsb - it's a big loss on modern intel cpus, and only a small win on amd cpus. + - improve c++ compatibility of the code. 3.5 Fri May 1 02:28:42 CEST 2009 - lzf_compress did sometimes write one octet past the given output diff --git a/bench.c b/bench.c index b108503..2ef977b 100644 --- a/bench.c +++ b/bench.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -41,8 +42,6 @@ static void sigu (int signum) { } -int eventfd(unsigned int,int); - #define DSIZE 2821120 unsigned char data[DSIZE], data2[DSIZE*2], data3[DSIZE*2]; @@ -56,7 +55,6 @@ int main(void) int lp; char buf[8192]; int p[2]; - int evfd = eventfd (0, 0); long ctr = 1; struct stat sbuf; diff --git a/lzfP.h b/lzfP.h index 10d804e..7f0e02b 100644 --- a/lzfP.h +++ b/lzfP.h @@ -94,7 +94,7 @@ /* * Avoid assigning values to errno variable? for some embedding purposes * (linux kernel for example), this is necessary. NOTE: this breaks - * the documentation in lzf.h. + * the documentation in lzf.h. Avoiding errno has no speed impact. */ #ifndef AVOID_ERRNO # define AVOID_ERRNO 0 @@ -124,13 +124,24 @@ /*****************************************************************************/ /* nothing should be changed below */ +#ifdef __cplusplus +# include +using namespace std; +#else +# include +#endif + typedef unsigned char u8; typedef const u8 *LZF_STATE[1 << (HLOG)]; #if !STRICT_ALIGN /* for unaligned accesses we need a 16 bit datatype. */ -# include +# ifdef __cplusplus +# include +# else +# include +# endif # if USHRT_MAX == 65535 typedef unsigned short u16; # elif UINT_MAX == 65535 @@ -142,17 +153,7 @@ typedef const u8 *LZF_STATE[1 << (HLOG)]; #endif #if ULTRA_FAST -# if defined(VERY_FAST) -# undef VERY_FAST -# endif -#endif - -#if INIT_HTAB -# ifdef __cplusplus -# include -# else -# include -# endif +# undef VERY_FAST #endif #endif diff --git a/lzf_d.c b/lzf_d.c index 396ccad..8433b8f 100644 --- a/lzf_d.c +++ b/lzf_d.c @@ -36,8 +36,6 @@ #include "lzfP.h" -#include /* for memcpy/memset */ - #if AVOID_ERRNO # define SET_ERRNO(n) #else -- cgit v1.2.3