diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 02:13:59 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 02:13:59 +0000 |
commit | a6d58bb6052ac8cb01805a48c4ad2f129126116f (patch) | |
tree | dd867a099fcbb263a8009a9fb22695b87855dad6 /src/kvilib/core/kvi_memmove.h | |
download | kvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.tar.gz kvirc-a6d58bb6052ac8cb01805a48c4ad2f129126116f.zip |
Added KDE3 version of kvirc
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kvirc@1095341 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kvilib/core/kvi_memmove.h')
-rw-r--r-- | src/kvilib/core/kvi_memmove.h | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/src/kvilib/core/kvi_memmove.h b/src/kvilib/core/kvi_memmove.h new file mode 100644 index 00000000..d1319a41 --- /dev/null +++ b/src/kvilib/core/kvi_memmove.h @@ -0,0 +1,105 @@ +#ifndef _KVI_MEMMOVE_H_ +#define _KVI_MEMMOVE_H_ + +//============================================================================= +// +// File : kvi_memmove.h +// Creation date : Fri Mar 19 1999 03:15:21 CEST by Szymon Stefanek +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 1999-2006 Szymon Stefanek (pragma at kvirc dot net) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +#define __KVILIB__ + +#include "kvi_settings.h" + +//#undef COMPILE_WITH_SYSTEM_MEMMOVE +//#define COMPILE_MMX_ASM + +#ifndef _KVI_MEMMOVE_CPP_ + + #ifdef COMPILE_WITH_SYSTEM_MEMMOVE + + #include <string.h> + + #define kvi_memmove memmove + #define kvi_memmoveodd memmove + #define kvi_memset memset + #define kvi_fastmove memcpy + #define kvi_fastmoveodd memcpy + + #else + + #ifdef COMPILE_ON_WINDOWS + #error "This stuff should be never compiled on Windows" + #endif + + extern void *kvi_memmove(void *dst_ptr,const void *src_ptr,int len); + extern void *kvi_memmoveodd(void *dst_ptr,const void *src_ptr,int len); + extern void *kvi_memset(void *dst_ptr,char c,int len); + // In fastmove the src and dst may not overlap + + #ifdef COMPILE_ix86_ASM + + // WE WANT repnz; movsq\n"!!! + + inline void kvi_fastmove(void * dst_ptr,const void *src_ptr,int len) + { + __asm__ __volatile__( + " cld\n" + " shr $1,%0\n" + " jnc 1f\n" + " movsb\n" + "1:\n" + " shr $1,%0\n" + " jnc 2f\n" + " movsw\n" + "2:\n" + " repnz; movsl\n" + : "=c" (len), "=&S" (src_ptr), "=&D" (dst_ptr) + : "0" (len), "1" (src_ptr), "2" (dst_ptr) + ); + } + + inline void kvi_fastmoveodd(void * dst_ptr,const void *src_ptr,int len) + { + __asm__ __volatile__( + " cld\n" + " shr $2,%0\n" + " jnc 1f\n" + " movsw\n" + "1:\n" + " repnz; movsl\n" + : "=c" (len), "=&S" (src_ptr), "=&D" (dst_ptr) + : "0" (len), "1" (src_ptr), "2" (dst_ptr) + ); + } + + #else // ! COMPILE_ix86_ASM + + extern void kvi_fastmove(void *dst_ptr,const void *src_ptr,int len); + extern void kvi_fastmoveodd(void *dst_ptr,const void *src_ptr,int len); + + #endif // !COMPILE_ix86_ASM + + #endif // COMPILE_WITH_SYSTEM_MEMMOVE + +#endif // _KVI_MEMMOVE_CPP_ + +#endif // !_KVI_MEMMOVE_H_ |