mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-04 10:26:16 -04:00
Fix a couple issues for Xcode projects (#513)
* Link separate JSystem libraries due to control.cpp This allows the Xcode generator to work, otherwise it breaks on the duplicate control.o files within the game_debug library. * Fix __memcpy define on GCC * Try LINK_GROUP:RESCAN for GNU ld * Combine dusk/game_base/game_debug targets * Fix compile defs syntax
This commit is contained in:
+54
-25
@@ -90,6 +90,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
|
||||
# Folder-based instead of target-based organization
|
||||
# in Visual Studio and Xcode generators
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "_cmake")
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
||||
set(DAWN_USE_WAYLAND ON CACHE BOOL "Enable support for Wayland surface" FORCE)
|
||||
endif ()
|
||||
@@ -281,7 +286,7 @@ set(DUSK_TP_VERSION ${DUSK_GAME_NAME}${DUSK_GAME_VERSION})
|
||||
|
||||
message(STATUS "dusk: Game Version: ${DUSK_TP_VERSION}")
|
||||
|
||||
source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${JSYSTEM_FILES} ${JSYSTEM_DEBUG_FILES} ${REL_FILES})
|
||||
source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${REL_FILES})
|
||||
source_group("dusk" FILES ${DUSK_FILES})
|
||||
|
||||
set(GAME_COMPILE_DEFS TARGET_PC WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0
|
||||
@@ -374,41 +379,65 @@ endif ()
|
||||
|
||||
# game_debug is for game code files that we know work when compiled with DEBUG=1
|
||||
# Of course, if building a release build, this distinction is irrelevant
|
||||
add_library(game_debug OBJECT ${JSYSTEM_DEBUG_FILES} ${SSYSTEM_FILES}
|
||||
set(GAME_DEBUG_FILES
|
||||
${SSYSTEM_FILES}
|
||||
src/dusk/audio/DuskAudioSystem.cpp
|
||||
src/dusk/audio/JASCriticalSection.cpp
|
||||
src/dusk/audio/DuskDsp.cpp
|
||||
src/dusk/audio/Adpcm.cpp
|
||||
src/dusk/audio/DspStub.cpp
|
||||
src/dusk/imgui/ImGuiAudio.cpp)
|
||||
src/dusk/imgui/ImGuiAudio.cpp
|
||||
)
|
||||
set_source_files_properties(
|
||||
${GAME_DEBUG_FILES}
|
||||
PROPERTIES
|
||||
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:DEBUG=1>;$<$<CONFIG:Debug>:PARTIAL_DEBUG=1>"
|
||||
)
|
||||
|
||||
# game_base is for all other game code files
|
||||
add_library(game_base OBJECT ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES} ${DOLPHIN_FILES})
|
||||
set(GAME_BASE_FILES
|
||||
${DOLZEL_FILES}
|
||||
${Z2AUDIOLIB_FILES}
|
||||
${REL_FILES}
|
||||
${DUSK_FILES}
|
||||
${DOLPHIN_FILES}
|
||||
)
|
||||
set_source_files_properties(
|
||||
${GAME_BASE_FILES}
|
||||
PROPERTIES
|
||||
COMPILE_DEFINITIONS "NDEBUG=1;NDEBUG_DEFINED=1;DEBUG_DEFINED=0;$<$<CONFIG:Debug>:PARTIAL_DEBUG=1>"
|
||||
)
|
||||
|
||||
target_compile_definitions(game_debug PRIVATE ${GAME_COMPILE_DEFS} $<$<CONFIG:Debug>:DEBUG=1> $<$<CONFIG:Debug>:PARTIAL_DEBUG=1>)
|
||||
target_compile_definitions(game_base PRIVATE ${GAME_COMPILE_DEFS} NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0 $<$<CONFIG:Debug>:PARTIAL_DEBUG=1>)
|
||||
foreach(jsystem_lib IN LISTS JSYSTEM_LIBRARIES)
|
||||
target_compile_definitions(${jsystem_lib} PRIVATE
|
||||
${GAME_COMPILE_DEFS}
|
||||
$<$<CONFIG:Debug>:DEBUG=1>
|
||||
$<$<CONFIG:Debug>:PARTIAL_DEBUG=1>
|
||||
)
|
||||
target_include_directories(${jsystem_lib} PRIVATE ${GAME_INCLUDE_DIRS})
|
||||
target_link_libraries(${jsystem_lib} PRIVATE ${GAME_LIBS})
|
||||
set_target_properties(${jsystem_lib} PROPERTIES FOLDER "JSystem")
|
||||
endforeach()
|
||||
|
||||
# only apply PCH to game_base since not all headers are necessarily validated with DEBUG=1
|
||||
target_precompile_headers(game_base PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_SOURCE_DIR}/include/dusk_pch.hpp>")
|
||||
|
||||
target_include_directories(game_debug PRIVATE ${GAME_INCLUDE_DIRS})
|
||||
target_include_directories(game_base PRIVATE ${GAME_INCLUDE_DIRS})
|
||||
|
||||
# This implicitly pulls in the library include directories even though no
|
||||
# linking actually takes place for object libraries
|
||||
target_link_libraries(game_debug PRIVATE ${GAME_LIBS})
|
||||
target_link_libraries(game_base PRIVATE ${GAME_LIBS})
|
||||
|
||||
if(ANDROID)
|
||||
add_library(dusk SHARED src/dusk/main.cpp)
|
||||
set_target_properties(dusk PROPERTIES OUTPUT_NAME main)
|
||||
else ()
|
||||
add_executable(dusk src/dusk/main.cpp)
|
||||
set(JSYSTEM_LINK_LIBRARIES ${JSYSTEM_LIBRARIES})
|
||||
if (CMAKE_CXX_LINK_GROUP_USING_RESCAN_SUPPORTED OR CMAKE_LINK_GROUP_USING_RESCAN_SUPPORTED)
|
||||
# GNU ld resolves static archives in a single left-to-right pass. The split
|
||||
# JSystem libraries reference each other, so they need a RESCAN group there.
|
||||
set(JSYSTEM_LINK_LIBRARIES "$<LINK_GROUP:RESCAN,${JSYSTEM_LIBRARIES}>")
|
||||
endif ()
|
||||
|
||||
target_compile_definitions(dusk PRIVATE TARGET_PC AVOID_UB=1 VERSION=0)
|
||||
target_include_directories(dusk PRIVATE include)
|
||||
target_link_libraries(dusk PRIVATE game_base game_debug aurora::main)
|
||||
set(DUSK_FILES src/dusk/main.cpp ${GAME_BASE_FILES} ${GAME_DEBUG_FILES})
|
||||
if(ANDROID)
|
||||
add_library(dusk SHARED ${DUSK_FILES})
|
||||
set_target_properties(dusk PROPERTIES OUTPUT_NAME main)
|
||||
else ()
|
||||
add_executable(dusk ${DUSK_FILES})
|
||||
endif ()
|
||||
|
||||
target_compile_definitions(dusk PRIVATE ${GAME_COMPILE_DEFS})
|
||||
target_include_directories(dusk PRIVATE ${GAME_INCLUDE_DIRS})
|
||||
target_link_libraries(dusk PRIVATE aurora::main ${GAME_LIBS} ${JSYSTEM_LINK_LIBRARIES})
|
||||
target_precompile_headers(dusk PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_SOURCE_DIR}/include/dusk_pch.hpp>")
|
||||
if (TARGET crashpad_handler)
|
||||
add_dependencies(dusk crashpad_handler)
|
||||
endif ()
|
||||
|
||||
Vendored
+1
-1
Submodule extern/aurora updated: 63550a8375...524b683fe0
+83
-3
@@ -314,7 +314,7 @@ set(SSYSTEM_FILES
|
||||
src/SSystem/SStandard/s_basic.cpp
|
||||
)
|
||||
|
||||
set(JSYSTEM_DEBUG_FILES
|
||||
add_library(JSystem_JParticle STATIC
|
||||
libs/JSystem/src/JParticle/JPAResourceManager.cpp
|
||||
libs/JSystem/src/JParticle/JPAResource.cpp
|
||||
libs/JSystem/src/JParticle/JPABaseShape.cpp
|
||||
@@ -330,10 +330,19 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/JParticle/JPAEmitter.cpp
|
||||
libs/JSystem/src/JParticle/JPAParticle.cpp
|
||||
libs/JSystem/src/JParticle/JPAMath.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JFramework STATIC
|
||||
libs/JSystem/src/JFramework/JFWSystem.cpp
|
||||
libs/JSystem/src/JFramework/JFWDisplay.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_J3DU STATIC
|
||||
libs/JSystem/src/J3DU/J3DUClipper.cpp
|
||||
libs/JSystem/src/J3DU/J3DUDL.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JKernel STATIC
|
||||
libs/JSystem/src/JKernel/JKRHeap.cpp
|
||||
libs/JSystem/src/JKernel/JKRExpHeap.cpp
|
||||
libs/JSystem/src/JKernel/JKRSolidHeap.cpp
|
||||
@@ -359,14 +368,23 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/JKernel/JKRDvdRipper.cpp
|
||||
libs/JSystem/src/JKernel/JKRDvdAramRipper.cpp
|
||||
libs/JSystem/src/JKernel/JKRDecomp.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JMath STATIC
|
||||
libs/JSystem/src/JMath/JMath.cpp
|
||||
libs/JSystem/src/JMath/random.cpp
|
||||
libs/JSystem/src/JMath/JMATrigonometric.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JSupport STATIC
|
||||
libs/JSystem/src/JSupport/JSUList.cpp
|
||||
libs/JSystem/src/JSupport/JSUInputStream.cpp
|
||||
libs/JSystem/src/JSupport/JSUOutputStream.cpp
|
||||
libs/JSystem/src/JSupport/JSUMemoryStream.cpp
|
||||
libs/JSystem/src/JSupport/JSUFileStream.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JUtility STATIC
|
||||
libs/JSystem/src/JUtility/JUTCacheFont.cpp
|
||||
libs/JSystem/src/JUtility/JUTResource.cpp
|
||||
libs/JSystem/src/JUtility/JUTTexture.cpp
|
||||
@@ -387,6 +405,9 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/JUtility/JUTConsole.cpp
|
||||
libs/JSystem/src/JUtility/JUTDirectFile.cpp
|
||||
libs/JSystem/src/JUtility/JUTFontData_Ascfont_fix12.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JStage STATIC
|
||||
libs/JSystem/src/JStage/JSGActor.cpp
|
||||
libs/JSystem/src/JStage/JSGAmbientLight.cpp
|
||||
libs/JSystem/src/JStage/JSGCamera.cpp
|
||||
@@ -394,6 +415,9 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/JStage/JSGLight.cpp
|
||||
libs/JSystem/src/JStage/JSGObject.cpp
|
||||
libs/JSystem/src/JStage/JSGSystem.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_J2DGraph STATIC
|
||||
libs/JSystem/src/J2DGraph/J2DGrafContext.cpp
|
||||
libs/JSystem/src/J2DGraph/J2DOrthoGraph.cpp
|
||||
libs/JSystem/src/J2DGraph/J2DTevs.cpp
|
||||
@@ -412,6 +436,9 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/J2DGraph/J2DAnmLoader.cpp
|
||||
libs/JSystem/src/J2DGraph/J2DAnimation.cpp
|
||||
libs/JSystem/src/J2DGraph/J2DManage.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_J3DGraphBase STATIC
|
||||
libs/JSystem/src/J3DGraphBase/J3DGD.cpp
|
||||
libs/JSystem/src/J3DGraphBase/J3DSys.cpp
|
||||
libs/JSystem/src/J3DGraphBase/J3DVertex.cpp
|
||||
@@ -426,6 +453,9 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/J3DGraphBase/J3DTevs.cpp
|
||||
libs/JSystem/src/J3DGraphBase/J3DDrawBuffer.cpp
|
||||
libs/JSystem/src/J3DGraphBase/J3DStruct.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_J3DGraphAnimator STATIC
|
||||
libs/JSystem/src/J3DGraphAnimator/J3DShapeTable.cpp
|
||||
libs/JSystem/src/J3DGraphAnimator/J3DJointTree.cpp
|
||||
libs/JSystem/src/J3DGraphAnimator/J3DModelData.cpp
|
||||
@@ -437,6 +467,9 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/J3DGraphAnimator/J3DCluster.cpp
|
||||
libs/JSystem/src/J3DGraphAnimator/J3DJoint.cpp
|
||||
libs/JSystem/src/J3DGraphAnimator/J3DMaterialAttach.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_J3DGraphLoader STATIC
|
||||
libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory.cpp
|
||||
libs/JSystem/src/J3DGraphLoader/J3DMaterialFactory_v21.cpp
|
||||
libs/JSystem/src/J3DGraphLoader/J3DClusterLoader.cpp
|
||||
@@ -445,6 +478,9 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/J3DGraphLoader/J3DJointFactory.cpp
|
||||
libs/JSystem/src/J3DGraphLoader/J3DShapeFactory.cpp
|
||||
libs/JSystem/src/J3DGraphLoader/J3DAnmLoader.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JStudio STATIC
|
||||
libs/JSystem/src/JStudio/JStudio/ctb.cpp
|
||||
libs/JSystem/src/JStudio/JStudio/ctb-data.cpp
|
||||
libs/JSystem/src/JStudio/JStudio/functionvalue.cpp
|
||||
@@ -459,6 +495,9 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/JStudio/JStudio/stb.cpp
|
||||
libs/JSystem/src/JStudio/JStudio/stb-data-parse.cpp
|
||||
libs/JSystem/src/JStudio/JStudio/stb-data.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JStudio_JStage STATIC
|
||||
libs/JSystem/src/JStudio/JStudio_JStage/control.cpp
|
||||
libs/JSystem/src/JStudio/JStudio_JStage/object.cpp
|
||||
libs/JSystem/src/JStudio/JStudio_JStage/object-actor.cpp
|
||||
@@ -466,10 +505,19 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/JStudio/JStudio_JStage/object-camera.cpp
|
||||
libs/JSystem/src/JStudio/JStudio_JStage/object-fog.cpp
|
||||
libs/JSystem/src/JStudio/JStudio_JStage/object-light.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JStudio_JAudio2 STATIC
|
||||
libs/JSystem/src/JStudio/JStudio_JAudio2/control.cpp
|
||||
libs/JSystem/src/JStudio/JStudio_JAudio2/object-sound.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JStudio_JParticle STATIC
|
||||
libs/JSystem/src/JStudio/JStudio_JParticle/control.cpp
|
||||
libs/JSystem/src/JStudio/JStudio_JParticle/object-particle.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JAudio2 STATIC
|
||||
libs/JSystem/src/JAudio2/JASCalc.cpp
|
||||
libs/JSystem/src/JAudio2/JASTaskThread.cpp
|
||||
libs/JSystem/src/JAudio2/JASDvdThread.cpp
|
||||
@@ -534,22 +582,34 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/JAudio2/JAUSoundAnimator.cpp
|
||||
libs/JSystem/src/JAudio2/JAUSoundTable.cpp
|
||||
libs/JSystem/src/JAudio2/JAUStreamFileTable.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JMessage STATIC
|
||||
libs/JSystem/src/JMessage/control.cpp
|
||||
libs/JSystem/src/JMessage/data.cpp
|
||||
libs/JSystem/src/JMessage/processor.cpp
|
||||
libs/JSystem/src/JMessage/resource.cpp
|
||||
libs/JSystem/src/JMessage/locale.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JGadget STATIC
|
||||
libs/JSystem/src/JGadget/binary.cpp
|
||||
libs/JSystem/src/JGadget/define.cpp
|
||||
libs/JSystem/src/JGadget/linklist.cpp
|
||||
libs/JSystem/src/JGadget/search.cpp
|
||||
libs/JSystem/src/JGadget/std-vector.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JAHostIO STATIC
|
||||
libs/JSystem/src/JAHostIO/JAHFrameNode.cpp
|
||||
libs/JSystem/src/JAHostIO/JAHioMessage.cpp
|
||||
libs/JSystem/src/JAHostIO/JAHioMgr.cpp
|
||||
libs/JSystem/src/JAHostIO/JAHioNode.cpp
|
||||
libs/JSystem/src/JAHostIO/JAHioUtil.cpp
|
||||
libs/JSystem/src/JAHostIO/JAHVirtualNode.cpp
|
||||
)
|
||||
|
||||
add_library(JSystem_JHostIO STATIC
|
||||
libs/JSystem/src/JHostIO/JORFile.cpp
|
||||
libs/JSystem/src/JHostIO/JORHostInfo.cpp
|
||||
libs/JSystem/src/JHostIO/JORMessageBox.cpp
|
||||
@@ -559,7 +619,28 @@ set(JSYSTEM_DEBUG_FILES
|
||||
libs/JSystem/src/JHostIO/JHIMccBuf.cpp
|
||||
)
|
||||
|
||||
set(JSYSTEM_FILES
|
||||
set(JSYSTEM_LIBRARIES
|
||||
JSystem_JParticle
|
||||
JSystem_JFramework
|
||||
JSystem_J3DU
|
||||
JSystem_JKernel
|
||||
JSystem_JMath
|
||||
JSystem_JSupport
|
||||
JSystem_JUtility
|
||||
JSystem_JStage
|
||||
JSystem_J2DGraph
|
||||
JSystem_J3DGraphBase
|
||||
JSystem_J3DGraphAnimator
|
||||
JSystem_J3DGraphLoader
|
||||
JSystem_JStudio
|
||||
JSystem_JStudio_JStage
|
||||
JSystem_JStudio_JAudio2
|
||||
JSystem_JStudio_JParticle
|
||||
JSystem_JAudio2
|
||||
JSystem_JMessage
|
||||
JSystem_JGadget
|
||||
JSystem_JAHostIO
|
||||
JSystem_JHostIO
|
||||
)
|
||||
|
||||
set(REL_FILES
|
||||
@@ -1341,7 +1422,6 @@ set(DUSK_FILES
|
||||
src/dusk/crash_reporting.cpp
|
||||
src/dusk/endian.cpp
|
||||
src/dusk/extras.c
|
||||
src/dusk/extras.cpp
|
||||
src/dusk/file_select.cpp
|
||||
src/dusk/file_select.hpp
|
||||
src/dusk/frame_interpolation.cpp
|
||||
|
||||
+11
-1
@@ -73,6 +73,9 @@
|
||||
#endif
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
// Silence clangd errors about MWCC PPC intrinsics by declaring them here.
|
||||
extern int __cntlzw(unsigned int);
|
||||
extern int __rlwimi(int, int, int, int, int);
|
||||
@@ -80,7 +83,14 @@ extern void __dcbf(void*, int);
|
||||
extern void __dcbz(void*, int);
|
||||
extern void __sync();
|
||||
extern int __abs(int);
|
||||
void* __memcpy(void*, const void*, int);
|
||||
#if defined(__has_builtin) && __has_builtin(__builtin_memcpy)
|
||||
#define __memcpy __builtin_memcpy
|
||||
#else
|
||||
#define __memcpy memcpy
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
|
||||
+21
-5
@@ -3,6 +3,27 @@
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
void __dcbz(void* addr, int offset) {
|
||||
// Gekko cache lines are 32 bytes.
|
||||
// dcbz usually requires addr to be 32-byte aligned.
|
||||
memset((char*)addr + offset, 0, 32);
|
||||
}
|
||||
|
||||
int __cntlzw(unsigned int val) {
|
||||
if (val == 0) return 32; // PowerPC returns 32 if the input is 0
|
||||
#ifdef _MSC_VER
|
||||
unsigned long idx;
|
||||
_BitScanReverse(&idx, val);
|
||||
return 31 - (int)idx;
|
||||
#else
|
||||
return __builtin_clz(val);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
int stricmp(const char* str1, const char* str2) {
|
||||
char a_var;
|
||||
@@ -48,11 +69,6 @@ int strnicmp(const char* str1, const char* str2, int n) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void *_memcpy(void* dest, void const* src, int n) {
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
void DCZeroRange(void* addr, uint32_t nBytes) {
|
||||
#if defined(_MSC_VER) || TARGET_ANDROID
|
||||
memset(addr, 0, nBytes);
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
// C++ Mangled version of extras.c
|
||||
#include <cstring>
|
||||
#include <cstdint>
|
||||
#ifdef _MSC_VER
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
void *__memcpy(void* dest, void const* src, int n) {
|
||||
return memcpy(dest, src, n);
|
||||
}
|
||||
|
||||
void __dcbz(void* addr, int offset) {
|
||||
// Gekko cache lines are 32 bytes.
|
||||
// dcbz usually requires addr to be 32-byte aligned.
|
||||
memset((char*)addr + offset, 0, 32);
|
||||
}
|
||||
|
||||
int __cntlzw(unsigned int val) {
|
||||
if (val == 0) return 32; // PowerPC returns 32 if the input is 0
|
||||
#ifdef _MSC_VER
|
||||
unsigned long idx;
|
||||
_BitScanReverse(&idx, val);
|
||||
return 31 - (int)idx;
|
||||
#else
|
||||
return __builtin_clz(val);
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user