Added win32 support.
This commit is contained in:
parent
65e88b7f76
commit
844e53910d
@ -10,9 +10,6 @@ include_directories(${CMAKE_BINARY_DIR})
|
|||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
set(CXX_STANDARD 23)
|
set(CXX_STANDARD 23)
|
||||||
|
|
||||||
set(BUILD_TESTS OFF)
|
|
||||||
set(BUILD_BENCHMARK OFF)
|
|
||||||
|
|
||||||
set(CAVM_RUNTIME_CHECK_SUPPORT ON)
|
set(CAVM_RUNTIME_CHECK_SUPPORT ON)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
@ -26,4 +23,6 @@ message("src " ${CONSTANT_POOL_TAG_SRC})
|
|||||||
add_executable(parser
|
add_executable(parser
|
||||||
${CONSTANT_POOL_TAG_SRC}
|
${CONSTANT_POOL_TAG_SRC}
|
||||||
)
|
)
|
||||||
set(CMAKE_CXX_FLAGS "-std=c++${CXX_STANDARD} -O0 -g -Wpedantic")
|
if (UNIX)
|
||||||
|
set(CMAKE_CXX_FLAGS "-std=c++${CXX_STANDARD} -O0 -g -Wpedantic")
|
||||||
|
endif()
|
@ -4,6 +4,17 @@
|
|||||||
#include <Types.h>
|
#include <Types.h>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
|
#define __builtin_bswap16 _byteswap_ushort
|
||||||
|
#define __builtin_bswap32 _byteswap_ulong
|
||||||
|
#define __builtin_bswap64 _byteswap_uint64
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class BigEndian
|
class BigEndian
|
||||||
{
|
{
|
||||||
@ -33,8 +44,8 @@ class BigEndian
|
|||||||
return __builtin_bswap32(val);
|
return __builtin_bswap32(val);
|
||||||
case 8:
|
case 8:
|
||||||
return __builtin_bswap64(val);
|
return __builtin_bswap64(val);
|
||||||
// Clang doesn't support __builtin_bswap128, so we fall back to a generic byte-order swap implementation
|
// Only gcc has a 128-bit byte-order swap builtin, so we fall back to a generic byte-order swap implementation for clang and for msvc
|
||||||
#ifndef __clang__
|
#if not defined(__clang__) && not defined(_MSC_VER)
|
||||||
case 16:
|
case 16:
|
||||||
return __builtin_bswap128(val);
|
return __builtin_bswap128(val);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user