From 3f65576372e239e558a1427d708630f01f08dded Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Thu, 1 Jan 2015 16:12:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D1=83=20=D0=B0=D1=81?= =?UTF-8?q?=D1=81=D0=B5=D0=BC=D0=B1=D0=BB=D0=B5=D1=80=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BA=D0=BE=D0=B4=D0=B0=20(=D0=BE=D0=BD=20=D0=BD?= =?UTF-8?q?=D0=B5=20=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=20=D0=B4=D0=BB=D1=8F=2032=20=D0=B1=D0=B8=D1=82=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC).=20=D0=9F?= =?UTF-8?q?=D0=BE=D1=87=D0=B8=D0=BD=D0=B8=D0=BB=20=D1=81=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=BA=D1=83=20=D1=81=20=D0=BF=D0=BE=D0=BC=D0=BE=D1=89=D1=8C?= =?UTF-8?q?=D1=8E=20clang=20=D0=BD=D0=B0=20linux.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/CMakeLists.txt | 8 ++++++-- src/ustring.cpp | 4 ++-- src/utf.cpp | 9 +++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5e94e7e..994f02e 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,8 +15,12 @@ SET(CMAKE_ASM_NASM_COMPILER yasm) project(${MAIN_PROJECT_NAME} CXX ASM_NASM) aux_source_directory(${SRC_DIR} SRC_FILES) -file(GLOB_RECURSE ASM_SRC_FILES "${SRC_DIR}/asm/${SYSTEM}/${ARCH}" "*.asm") -set(SRC_FILES ${SRC_FILES} ${ASM_SRC_FILES}) + +if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + file(GLOB_RECURSE ASM_SRC_FILES "${SRC_DIR}/asm/${SYSTEM}/${ARCH}" "*.asm") + set(SRC_FILES ${SRC_FILES} ${ASM_SRC_FILES}) +endif() + include_directories(${INCLUDE_DIR}) add_library(${MAIN_PROJECT_NAME} STATIC ${SRC_FILES}) target_link_libraries(${MAIN_PROJECT_NAME}) diff --git a/src/ustring.cpp b/src/ustring.cpp index 6880a89..bf50695 100755 --- a/src/ustring.cpp +++ b/src/ustring.cpp @@ -382,18 +382,18 @@ std::size_t ustring::find(const ustring& str, std::size_t pos /* = 0 */) const } #if defined(__GNUC__) // GCC and clang - /* char32_t* fpos = reinterpret_cast(memmem(_pData + pos, (_len - pos)*sizeof(char32_t), str._pData, str._len*sizeof(char32_t))); if(fpos) { return (fpos - _pData); } - */ + /* const char32_t* fpos = _asm_ucs4_strstr(_pData + pos, (_len - pos), str._pData, str._len); if(fpos) { return (fpos - _pData); } + */ #else const char32_t* pStr = str._pData; const std::size_t len = _len - str.length(); diff --git a/src/utf.cpp b/src/utf.cpp index b442ec8..e48eeb5 100755 --- a/src/utf.cpp +++ b/src/utf.cpp @@ -1,12 +1,9 @@ #include "utf.h" #include -#if defined(__clang__) - #include - #define bswap_32 OSSwapInt32 - #define bswap_16 OSSwapInt16 -#elif defined(__GNUC__) - #include +#if defined(__GNUC__) + #define bswap_16 __builtin_bswap16 + #define bswap_32 __builtin_bswap32 #elif defined(_MSC_VER) #define bswap_16 _byteswap_ushort #define bswap_32 _byteswap_ulong