Get latest changes from Primitive Indexer
This commit is contained in:
+250
-129
@@ -1,10 +1,11 @@
|
||||
// Generated by the DN single header generator 2026-06-18 22:11:00
|
||||
// Generated by the DN single header generator 2026-06-23 21:12:54
|
||||
|
||||
#if !defined(DN_H)
|
||||
#define DN_H
|
||||
|
||||
// NOTE: DN
|
||||
// Getting Started
|
||||
|
||||
// NOTE: Getting Started
|
||||
// Include this mega header `dn.h` and define the following symbols to `1` to conditionally
|
||||
// enable the interfaces for those features. Additionally in the same or different translation
|
||||
// unit, include `dn.cpp` with the same symbols defined to enable the implementation of these
|
||||
@@ -35,9 +36,10 @@
|
||||
// synchronisation, memory allocation. This layer is OPTIONAL.
|
||||
//
|
||||
// - Extra layer provides helper utilities that are opt-in. These layers are OPTIONAL.
|
||||
//
|
||||
// Configuration
|
||||
// Platform Target
|
||||
|
||||
// NOTE: Configuration
|
||||
|
||||
// NOTE: Platform Target
|
||||
// Define one of the following directives to configure this library to compile for that
|
||||
// platform. By default, the library will auto-detect the current host platform and select that
|
||||
// as the target platform.
|
||||
@@ -52,8 +54,8 @@
|
||||
//
|
||||
// Will ensure that <Windows.h> is included and the OS layer is implemented using Win32
|
||||
// primitives.
|
||||
//
|
||||
// Static functions
|
||||
|
||||
// NOTE: Static functions
|
||||
// All public functions in the DN library are prefixed with the macro '#define DN_API'. By
|
||||
// default 'DN_API' is not defined to anything. Define
|
||||
//
|
||||
@@ -62,8 +64,8 @@
|
||||
// To replace all the functions prefixed with DN_API to be prefixed with 'static' ensuring that
|
||||
// the functions in the library do not export an entry into the linking table.
|
||||
// translation units.
|
||||
//
|
||||
// Disabling the in-built <Windows.h> (if #define DN_H_WITH_OS 1)
|
||||
|
||||
// NOTE: Disabling the in-built <Windows.h> (if #define DN_H_WITH_OS 1)
|
||||
// If you are building DN for the Windows platform, <Windows.h> is a large legacy header that
|
||||
// applications have to include to use Windows APIs. By default this library uses a replacement
|
||||
// header for all the Windows functions that it uses in the OS layer removing the need to
|
||||
@@ -76,16 +78,16 @@
|
||||
// To instead use <Windows.h>. DN automatically detects if <Windows.h> is included in an earlier
|
||||
// translation unit and will automatically disable the in-built replacement header in which case
|
||||
// this does not need to be defined.
|
||||
//
|
||||
// Freestanding
|
||||
|
||||
// NOTE: Freestanding
|
||||
// The base layer can be used without an OS implementation by defining DN_FREESTANDING like:
|
||||
//
|
||||
// #define DN_FREESTANDING
|
||||
//
|
||||
// This means functionality that relies on the OS like printing, memory allocation, stack traces
|
||||
// and so forth are disabled.
|
||||
//
|
||||
// ASAN Arena Poisoning
|
||||
|
||||
// NOTE: ASAN Arena Poisoning
|
||||
// When compiled with address sanitizer (.e.g -fsanitize=address) you can optionally enable
|
||||
// memory region poisoning on the inbuilt arena's to catch in certain scenarios, use-after-free
|
||||
//
|
||||
@@ -95,8 +97,8 @@
|
||||
// memory markup that ASAN does and so it is implemented manually by using the ASAN user-level
|
||||
// poisoning APIs. Similarly, since the arena recycles its own memory rather than release back
|
||||
// to the OS, poisoning is not as effective for arenas but every little bit helps.
|
||||
//
|
||||
// Scrub Uninitialised Memory
|
||||
|
||||
// NOTE: Scrub Uninitialised Memory
|
||||
// If this macro is defined, temp memory that is returned to an arena, or allocations freed by
|
||||
// a pool are scrubbed to this specified byte, in absence of this bytes returned to the
|
||||
// allocators are left as-is or memset to 0. For example to scrub bytes to 0xCD (MSVC's
|
||||
@@ -107,8 +109,8 @@
|
||||
// Due to the recycling of memory in arenas and pool, similarly to ASAN poisoning this reduces
|
||||
// the window in which a use-after-free can be detected using this guard, however every little
|
||||
// bit helps.
|
||||
//
|
||||
// Arena temp memory use-after-free (UAF) tooling
|
||||
|
||||
// NOTE: Arena temp memory use-after-free (UAF) tooling
|
||||
// UAF Guard
|
||||
// Set the following preprocessor value to 1 to enable UAF protection when using
|
||||
// scratch/temporary memory functionality. Defaults to off, or 0 if not specified
|
||||
@@ -129,7 +131,7 @@
|
||||
// memory block and additional book-keeping fields on each arena and their temp memory
|
||||
// instances.
|
||||
//
|
||||
// UAF Tracing
|
||||
// NOTE: UAF Tracing
|
||||
// Set the following preprocessor value to 1 to enable tracing when the UAF guard triggers.
|
||||
// Defaults to off, or 0 if not specified.
|
||||
//
|
||||
@@ -143,11 +145,57 @@
|
||||
// Tracing incurs an additional much heavier performance penalty than the UAF guard due to
|
||||
// the stacktrace that is stored per region to report to the user when a UAF guard violation
|
||||
// occurs.
|
||||
|
||||
// NOTE: Paranoia Level
|
||||
// Set the `DN_PARANOIA_LEVEL` to an integer value to enable various validation layers and
|
||||
// error checking mechanisms in the codebase and primitives exposed by the library. Defaults to
|
||||
// paranoia level 0 in release builds and level 1 for debug.
|
||||
//
|
||||
// Str8 AVX512F variants
|
||||
// We have some AVX512 string functions that can be enabled by defining the following
|
||||
// #define DN_PARANOIA_LEVEL 1
|
||||
//
|
||||
// #define DN_STR8_AVX512F 1
|
||||
// Each level activates the following debug mechanisms. Note that any of the following #defines
|
||||
// enabled by a paranoia level can be overridden by defining the preprocessor definition before
|
||||
// the inclusion of this file.
|
||||
//
|
||||
// Level 0
|
||||
// `DN_Assert` calls are compiled out
|
||||
//
|
||||
// `DN_Verify` calls logs an error and continues
|
||||
//
|
||||
// `DN_VerifyWarning` calls logs a warning and continues
|
||||
//
|
||||
// Level 1
|
||||
// `DN_Assert` calls are compiled in
|
||||
//
|
||||
// `DN_Verify` calls a debug trap rather than just logging and continuing
|
||||
//
|
||||
// `DN_Verify` calls dump a stack trace when triggered
|
||||
//
|
||||
// `DN_ASAN_POISON` is set. When an arena allocates memory unallocated bytes from the
|
||||
// memory owned by the arena are manually poisoned using ASAN. A fault will be triggered if
|
||||
// the memory is written to (UAF e.g. use-after-free). Address sanitizer must be enabled or
|
||||
// otherwise this is a no-op. This incurs a performance penalty on-top of the overhead of
|
||||
// running ASAN on your binary as recycling memory calls into ASAN to poison the region.
|
||||
//
|
||||
// `DN_ARENA_TEMP_MEM_UAF_GUARD` is set. When an arena uses temporary memory it will record
|
||||
// the active temporary memory region and compare them when allocating to ensure that
|
||||
// memory is allocated in the active region otherwise a UAF fault is triggered. This has a
|
||||
// small runtime performance penalty.
|
||||
//
|
||||
// `DN_SCRUB_UNINIT_MEM_BYTE` is set to `0xCD`. When memory is cleared in an arena or a
|
||||
// pool backed by an arena upon deallocation if the `DN_ZMem_Yes` flag is passed then the
|
||||
// bytes are scrubbed to this byte to make UAF more salient.
|
||||
//
|
||||
// Level 2
|
||||
// `DN_ARENA_TEMP_MEM_UAF_TRACE_ON_BY_DEFAULT` is set. When an arena uses temporary memory
|
||||
// regions that region's a stack trace of the call site is recorded. This is very expensive
|
||||
// but when a temporary memory region is used after it has been deallocated, a full stack
|
||||
// trace diagnostic is available of where the various regions where created and freed.
|
||||
//
|
||||
// NOTE: Str8 AVX512F variants
|
||||
// We have some AVX512 string functions that can be enabled by defining the following
|
||||
//
|
||||
// #define DN_STR8_AVX512F 1
|
||||
|
||||
// DN: Single header generator commented out => #include "Base/dn_base.h"
|
||||
#if !defined(DN_BASE_H)
|
||||
@@ -155,6 +203,7 @@
|
||||
|
||||
// DN: Single header generator commented out => #if defined(_CLANGD)
|
||||
// #define DN_STR8_AVX512F 1
|
||||
// #define DN_PARANOIA_LEVEL 1
|
||||
// #include "../dn.h"
|
||||
// #endif
|
||||
|
||||
@@ -299,99 +348,160 @@
|
||||
#define DN_ZeroInit {0}
|
||||
#endif
|
||||
|
||||
// NOTE: Address sanitizer
|
||||
#if !defined(DN_ASAN_POISON)
|
||||
#define DN_ASAN_POISON 0
|
||||
#endif
|
||||
// NOTE: Macros
|
||||
#define DN_Stringify(x) #x
|
||||
#define DN_TokenCombine2(x, y) x ## y
|
||||
#define DN_TokenCombine(x, y) DN_TokenCombine2(x, y)
|
||||
|
||||
#if !defined(DN_ASAN_VET_POISON)
|
||||
#define DN_ASAN_VET_POISON 0
|
||||
#endif
|
||||
// NOTE: Error Checking/Validating
|
||||
// Asserts are useful to verify invariants in the codebase, but there's sometimes the ambiguous
|
||||
// question of what should be asserted, what happens when we should have triggered an assert
|
||||
// in a release build (where they are canonically turned off), what alternative mechanisms should we
|
||||
// use for error checking that should be visible to non-developers.
|
||||
//
|
||||
// The following is an excerpt from Tom Forsyth's assertion article which he references Chris
|
||||
// Hargrove's guidelines on how asserts show be used. It is quite reasonable and we model our
|
||||
// primitives after based on those concepts:
|
||||
//
|
||||
// Logging, asserts and unit tests (https://tomforsyth1000.github.io/blog.wiki.html
|
||||
//
|
||||
// Assert: Immediately fatal, and not ignorable. Fundamental assumption by an engineer has been
|
||||
// disproven and needs immediate handling. Requires discipline on the part of the engineer to not
|
||||
// add them in situations that are actually non-fatal (rule of thumb being that if a crash would
|
||||
// be almost certain to happen anyway due to the same condition, then you’re no worse off making
|
||||
// an assert).
|
||||
//
|
||||
// Errors: Probably fatal soon, but not necessarily immediately. Basically a marker for “you are
|
||||
// now in a f*cked state, you might limp along a bit, but assume nothing”. Game continues, but an
|
||||
// ugly red number gets displayed onscreen for how many of these have been encountered (so when
|
||||
// people send you screenshots of bugs you can then point to the red error count and blame
|
||||
// accordingly). Savegames are disabled from this point so as not to make the error effectively
|
||||
// permanent; you should also deliberately violate a few other TCRs as soon as an error is
|
||||
// encountered in order to ensure that all parties up and down the publisher/developer chain are
|
||||
// aware of how bad things are. Errors are technically “ignorable” but everyone knows that it
|
||||
// might only buy you a little bit of borrowed time; these are only a small step away from the
|
||||
// immediately-blocking nature of an assert, but sometimes that small step can have a big impact
|
||||
// on productivity.
|
||||
//
|
||||
// Warnings: Used for “you did something bad, but we caught it so it’s fine (the game state is
|
||||
// still okay), however it might not be fine in the future so if you want to save yourself some
|
||||
// headache you should fix this sooner rather than later”. Great for content problems. Also
|
||||
// displayed onscreen as a yellow number (near the red error number). You can keep these around
|
||||
// for a while and triage them when their utility is called into question.
|
||||
//
|
||||
// Crumbs: The meta-category for a large number of “verbose” informational breadcrumb categories
|
||||
// that must be explicitly enabled so you don’t clutter everything up and obscure stuff that
|
||||
// matters. Note that the occurrance of certain Errors should automatically enable relevant
|
||||
// categories of crumbs so that more detailed information about the aforementioned f*cked state
|
||||
// will be provided during the limp-along timeframe.
|
||||
//
|
||||
// In the excerpt, their domain (games programming) prioritises continuity over immediate failure
|
||||
// on warning and error as this allows non-developer clientele to continue using the application
|
||||
// despite error laden states. This is useful in general as not all failures are critical to the
|
||||
// use case that the end user is dealing with.
|
||||
//
|
||||
// We model `Errors` and `Warnings` as `DN_Verify` and `DN_VerifyWarning` respectively. The verify
|
||||
// variants check the expression to test, log and a message and allow the developer to branch on the
|
||||
// result and "recover" where appropriate. Verify checks are never compiled out. We have traditional
|
||||
// `Asserts` as `DN_Assert` which can be compiled out.
|
||||
//
|
||||
// The article also defines what it calls a paranoia level. We `#define DN_PARANOIA_LEVEL <Integer>`
|
||||
// to customise the validation layers of the codebase. See DN_PARANOIA_LEVEL in the customisation
|
||||
// section for more information.
|
||||
//
|
||||
// In summary use each of the primitives in these situation:
|
||||
//
|
||||
// `DN_Assert`: Fatal and immediately needs attention and can be compiled out
|
||||
//
|
||||
// `DN_Verify`: Fatal or eventually fatal but not necessarily immediately, program is or will
|
||||
// degenerate into an incorrect state. Is always compiled in and is visible in non-debug
|
||||
// environments.
|
||||
//
|
||||
// `DN_VerifyWarning`: Something bad happened, but we caught it and recovered from it. Program
|
||||
// state remains consistent. It is always compiled in and is visible in non-debug environments.
|
||||
|
||||
#define DN_ASAN_POISON_ALIGNMENT 8
|
||||
|
||||
#if !defined(DN_ASAN_POISON_GUARD_SIZE)
|
||||
#define DN_ASAN_POISON_GUARD_SIZE 128
|
||||
#if !defined(DN_PARANOIA_LEVEL)
|
||||
#if defined(NDEBUG)
|
||||
#define DN_PARANOIA_LEVEL 0
|
||||
#else
|
||||
#define DN_PARANOIA_LEVEL 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if DN_HAS_FEATURE(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
|
||||
#include <sanitizer/asan_interface.h>
|
||||
#endif
|
||||
|
||||
// NOTE: Memory
|
||||
#define DN_ASAN_POISON_ALIGNMENT 8
|
||||
#if !defined(DN_ASAN_VET_POISON)
|
||||
#define DN_ASAN_VET_POISON 0
|
||||
#endif
|
||||
|
||||
#if !defined(DN_ASAN_POISON)
|
||||
#if DN_PARANOIA_LEVEL >= 1
|
||||
#define DN_ASAN_POISON 1
|
||||
#else
|
||||
#define DN_ASAN_POISON 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(DN_ASAN_POISON_GUARD_SIZE)
|
||||
#define DN_ASAN_POISON_GUARD_SIZE 128
|
||||
#endif
|
||||
|
||||
#if !defined(DN_ARENA_TEMP_MEM_UAF_GUARD)
|
||||
#define DN_ARENA_TEMP_MEM_UAF_GUARD 0
|
||||
#if DN_PARANOIA_LEVEL >= 1
|
||||
#define DN_ARENA_TEMP_MEM_UAF_GUARD 1
|
||||
#else
|
||||
#define DN_ARENA_TEMP_MEM_UAF_GUARD 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(DN_ARENA_TEMP_MEM_UAF_TRACE_ON_BY_DEFAULT)
|
||||
#define DN_ARENA_TEMP_MEM_UAF_TRACE_ON_BY_DEFAULT 0
|
||||
#if DN_PARANOIA_LEVEL >= 2
|
||||
#define DN_ARENA_TEMP_MEM_UAF_TRACE_ON_BY_DEFAULT 1
|
||||
#else
|
||||
#define DN_ARENA_TEMP_MEM_UAF_TRACE_ON_BY_DEFAULT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(DN_SCRUB_UNINIT_MEM_BYTE)
|
||||
#define DN_SCRUB_UNINIT_MEM_BYTE 0
|
||||
#if DN_PARANOIA_LEVEL >= 1
|
||||
#define DN_SCRUB_UNINIT_MEM_BYTE 0xCD
|
||||
#else
|
||||
#define DN_SCRUB_UNINIT_MEM_BYTE 0x00
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// NOTE: Macros
|
||||
#define DN_Stringify(x) #x
|
||||
#define DN_TokenCombine2(x, y) x ## y
|
||||
#define DN_TokenCombine(x, y) DN_TokenCombine2(x, y)
|
||||
|
||||
// NOTE: Asserts
|
||||
#define DN_HardAssertF(expr, fmt, ...) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
DN_Str8 stack_trace_ = DN_Str8FromStackTraceNowHeap(128 /*limit*/, 3 /*skip*/); \
|
||||
DN_LogErrorF("Hard assertion [" #expr "], stack trace was:\n\n%.*s\n\n" fmt, \
|
||||
DN_Str8PrintFmt(stack_trace_), \
|
||||
##__VA_ARGS__); \
|
||||
DN_DebugBreak; \
|
||||
} \
|
||||
#define DN_AssertRaw(expr) do { if (!(expr)) DN_DebugBreak; } while (0)
|
||||
#define DN_AssertAlwaysCallSiteF(expr, call_site, fmt, ...) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
DN_Str8 trace_ = DN_Str8FromStackTraceNowHeap(128 /*limit*/, 3 /*skip*/); \
|
||||
DN_LogTypeParam log_type_ = DN_LogTypeParamFromType(DN_LogType_Error); \
|
||||
DN_LogPrintF(log_type_, call_site, DN_LogFlags_Nil, "Assertion triggered [" #expr "]. " fmt "\nTrace:\n%.*s", ## __VA_ARGS__, DN_Str8PrintFmt(trace_)); \
|
||||
DN_DebugBreak; \
|
||||
} \
|
||||
} while (0)
|
||||
#define DN_HardAssert(expr) DN_HardAssertF(expr, "")
|
||||
|
||||
// NOTE: Our default assert requires stack traces which has a bit of a chicken-and-egg problem if
|
||||
// we're trying to detect some code related to the DN startup sequence. If we try to assert before
|
||||
// the OS layer is initialised stack-traces will try to use temporary memory which requires TLS to
|
||||
// be setup which belongs to the OS.
|
||||
//
|
||||
// This causes recursion errors as they call into each other. We use RawAsserts for these kind of
|
||||
// checks.
|
||||
#if defined(DN_NO_ASSERT)
|
||||
#define DN_RawAssert(...)
|
||||
#define DN_Assert(...)
|
||||
#define DN_AssertOnce(...)
|
||||
#define DN_AssertArgsF(...)
|
||||
#define DN_AssertF(...)
|
||||
#define DN_AssertFOnce(...)
|
||||
#define DN_AssertAlwaysF(expr, fmt, ...) DN_AssertAlwaysCallSiteF(expr, (DN_CallSiteNow), fmt, ##__VA_ARGS__)
|
||||
#define DN_AssertAlways(expr) DN_AssertAlwaysF(expr, "")
|
||||
#define DN_AssertInvalidCodePathF(fmt, ...) DN_AssertAlwaysF(0, fmt, ##__VA_ARGS__)
|
||||
#define DN_AssertInvalidCodePath DN_AssertInvalidCodePathF("Invalid code path")
|
||||
#if DN_PARANOIA_LEVEL >= 1
|
||||
#define DN_AssertCallSiteF(expr, call_site, fmt, ...) DN_AssertAlwaysCallSiteF(expr, call_site, fmt, ## __VA_ARGS__)
|
||||
#define DN_AssertF(expr, fmt, ...) DN_AssertCallSiteF(expr, (DN_CallSiteNow), fmt, ## __VA_ARGS__)
|
||||
#define DN_Assert(expr) DN_AssertAlways(expr)
|
||||
#else
|
||||
#define DN_RawAssert(expr) do { if (!(expr)) DN_DebugBreak; } while (0)
|
||||
#define DN_AssertArgsF(expr, call_site, fmt, ...) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
DN_Str8 stack_trace_ = DN_Str8FromStackTraceNowHeap(128 /*limit*/, 3 /*skip*/); \
|
||||
DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Error), \
|
||||
call_site, \
|
||||
DN_LogFlags_Nil, \
|
||||
"Assertion [" #expr "], stack trace was:\n\n%.*s\n\n" fmt, \
|
||||
DN_Str8PrintFmt(stack_trace_), \
|
||||
##__VA_ARGS__); \
|
||||
DN_DebugBreak; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DN_AssertF(expr, fmt, ...) DN_AssertArgsF(expr, DN_CALL_SITE, fmt, ## __VA_ARGS__)
|
||||
#define DN_AssertFOnce(expr, fmt, ...) \
|
||||
do { \
|
||||
for (static bool once_ = true; !(expr) && once_; once_ = false) \
|
||||
DN_AssertF(expr, fmt, ## __VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#define DN_Assert(expr) DN_AssertF((expr), "")
|
||||
#define DN_AssertOnce(expr) DN_AssertFOnce((expr), "")
|
||||
#define DN_AssertCallSiteF(expr, call_site, fmt, ...) (void)(expr); (void)call_site
|
||||
#define DN_AssertF(expr, fmt, ...) (void)(expr)
|
||||
#define DN_Assert(expr) (void)(expr)
|
||||
#endif
|
||||
#define DN_VerifyF(expr, fmt, ...) DN_VerifyArgsF(DN_VerifyType_Nil, expr, (DN_CallSiteNow), DN_Str8Lit(#expr), fmt, ##__VA_ARGS__)
|
||||
#define DN_VerifyWarningF(expr, fmt, ...) DN_VerifyArgsF(DN_VerifyType_Warning, expr, (DN_CallSiteNow), DN_Str8Lit(#expr), fmt, ##__VA_ARGS__)
|
||||
#define DN_Verify(expr) DN_VerifyF(expr, 0)
|
||||
#define DN_VerifyWarning(expr) DN_VerifyWarningF(expr, 0)
|
||||
|
||||
#define DN_InvalidCodePathF(fmt, ...) DN_HardAssertF(0, fmt, ##__VA_ARGS__)
|
||||
#define DN_InvalidCodePath DN_InvalidCodePathF("Invalid code path triggered")
|
||||
#define DN_StaticAssert(expr) \
|
||||
DN_GCC_WARNING_PUSH \
|
||||
DN_GCC_WARNING_DISABLE(-Wunused-local-typedefs) \
|
||||
@@ -633,6 +743,12 @@ typedef DN_I32 DN_B32;
|
||||
#define DN_CountLeadingZerosUSize(value) DN_CountLeadingZerosU32(value)
|
||||
#endif
|
||||
|
||||
enum DN_VerifyType
|
||||
{
|
||||
DN_VerifyType_Nil,
|
||||
DN_VerifyType_Warning,
|
||||
};
|
||||
|
||||
enum DN_ZMem
|
||||
{
|
||||
DN_ZMem_No, // Memory can be handed out without zero-ing it out
|
||||
@@ -831,7 +947,7 @@ struct DN_CallSite
|
||||
DN_U32 line;
|
||||
};
|
||||
|
||||
#define DN_CALL_SITE DN_CallSite { DN_Str8Lit(__FILE__), DN_Str8Lit(__func__), __LINE__ }
|
||||
#define DN_CallSiteNow DN_Literal(DN_CallSite){DN_Str8Lit(__FILE__), DN_Str8Lit(__func__), __LINE__ }
|
||||
|
||||
#if defined(__cplusplus)
|
||||
template <typename Procedure>
|
||||
@@ -3712,6 +3828,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
DN_GCC_WARNING_POP
|
||||
DN_MSVC_WARNING_POP
|
||||
|
||||
DN_API bool DN_VerifyArgsF (DN_VerifyType type, bool expr, DN_CallSite call_site, DN_Str8 expr_str8, char const *fmt, ...);
|
||||
DN_API bool DN_VerifyArgs (DN_VerifyType type, bool expr, DN_CallSite call_site, DN_Str8 expr_str8);
|
||||
|
||||
#define DN_SPrintF(...) STB_SPRINTF_DECORATE(sprintf)(__VA_ARGS__)
|
||||
#define DN_SNPrintF(...) STB_SPRINTF_DECORATE(snprintf)(__VA_ARGS__)
|
||||
#define DN_VSPrintF(...) STB_SPRINTF_DECORATE(vsprintf)(__VA_ARGS__)
|
||||
@@ -3721,8 +3840,8 @@ DN_API bool DN_MemStartsWith
|
||||
DN_API bool DN_MemEq (void const *lhs, DN_USize lhs_size, void const *rhs, DN_USize rhs_size);
|
||||
DN_API bool DN_MemEqUnsafe (void const *lhs, void const *rhs, DN_USize size);
|
||||
#if defined(__cplusplus)
|
||||
template <typename T> T* DN_TMemCopyObj (T *dest, T const *src, DN_USize count);
|
||||
#define DN_MemCopyObj(dest, src, count) DN_TMemCopyObj(dest, src, count)
|
||||
template <typename T> T* DN_MemCopyObjT (T *dest, T const *src, DN_USize count);
|
||||
#define DN_MemCopyObj(dest, src, count) DN_MemCopyObjT(dest, src, count)
|
||||
#else
|
||||
#define DN_MemCopyObj(dest, src, count) DN_Memcpy(dest, src, sizeof(*src) * count)
|
||||
#endif
|
||||
@@ -3783,6 +3902,7 @@ DN_API void DN_BitUnsetInplace
|
||||
DN_API void DN_BitSetInplace (DN_USize *flags, DN_USize bitfield);
|
||||
DN_API bool DN_BitIsSet (DN_USize bits, DN_USize bits_to_set);
|
||||
DN_API bool DN_BitIsNotSet (DN_USize bits, DN_USize bits_to_check);
|
||||
DN_API bool DN_BitIsAny (DN_USize bits, DN_USize bits_to_check);
|
||||
#define DN_BitClearNextLSB(value) (value) & ((value) - 1)
|
||||
|
||||
DN_API DN_I64 DN_SafeAddI64 (DN_I64 a, DN_I64 b);
|
||||
@@ -3955,26 +4075,26 @@ DN_API void * DN_PoolCopy
|
||||
#define DN_PoolNewArrayCopy(pool, T, src, count) (T *)DN_PoolCopy (pool, (src), sizeof(T) * (count), alignof(T))
|
||||
|
||||
DN_API DN_ErrSink* DN_ErrSinkBegin_ (DN_ErrSink *err, DN_ErrSinkMode mode, DN_CallSite call_site);
|
||||
#define DN_ErrSinkBegin(err, mode) DN_ErrSinkBegin_(err, mode, DN_CALL_SITE)
|
||||
#define DN_ErrSinkBegin(err, mode) DN_ErrSinkBegin_(err, mode, DN_CallSiteNow)
|
||||
#define DN_ErrSinkBeginDefault(err) DN_ErrSinkBegin(err, DN_ErrSinkMode_Nil)
|
||||
DN_API bool DN_ErrSinkHasError (DN_ErrSink *err);
|
||||
DN_API DN_ErrSinkMsg* DN_ErrSinkEnd (DN_Arena *arena, DN_ErrSink *err);
|
||||
DN_API DN_Str8 DN_ErrSinkEndStr8 (DN_Arena *arena, DN_ErrSink *err);
|
||||
DN_API void DN_ErrSinkEndIgnore (DN_ErrSink *err);
|
||||
DN_API bool DN_ErrSinkEndLogError_ (DN_ErrSink *err, DN_CallSite call_site, DN_Str8 msg);
|
||||
#define DN_ErrSinkEndLogError(err, err_msg) DN_ErrSinkEndLogError_(err, DN_CALL_SITE, err_msg)
|
||||
#define DN_ErrSinkEndLogError(err, err_msg) DN_ErrSinkEndLogError_(err, DN_CallSiteNow, err_msg)
|
||||
DN_API bool DN_ErrSinkEndLogErrorFV_ (DN_ErrSink *err, DN_CallSite call_site, DN_FMT_ATTRIB char const *fmt, va_list args);
|
||||
#define DN_ErrSinkEndLogErrorFV(err, fmt, args) DN_ErrSinkEndLogErrorFV_(err, DN_CALL_SITE, fmt, args)
|
||||
#define DN_ErrSinkEndLogErrorFV(err, fmt, args) DN_ErrSinkEndLogErrorFV_(err, DN_CallSiteNow, fmt, args)
|
||||
DN_API bool DN_ErrSinkEndLogErrorF_ (DN_ErrSink *err, DN_CallSite call_site, DN_FMT_ATTRIB char const *fmt, ...);
|
||||
#define DN_ErrSinkEndLogErrorF(err, fmt, ...) DN_ErrSinkEndLogErrorF_(err, DN_CALL_SITE, fmt, ##__VA_ARGS__)
|
||||
#define DN_ErrSinkEndLogErrorF(err, fmt, ...) DN_ErrSinkEndLogErrorF_(err, DN_CallSiteNow, fmt, ##__VA_ARGS__)
|
||||
DN_API void DN_ErrSinkEndExitIfErrorF_ (DN_ErrSink *err, DN_CallSite call_site, DN_U32 exit_val, DN_FMT_ATTRIB char const *fmt, ...);
|
||||
#define DN_ErrSinkEndExitIfErrorF(err, exit_val, fmt, ...) DN_ErrSinkEndExitIfErrorF_(err, DN_CALL_SITE, exit_val, fmt, ##__VA_ARGS__)
|
||||
#define DN_ErrSinkEndExitIfErrorF(err, exit_val, fmt, ...) DN_ErrSinkEndExitIfErrorF_(err, DN_CallSiteNow, exit_val, fmt, ##__VA_ARGS__)
|
||||
DN_API void DN_ErrSinkEndExitIfErrorFV_ (DN_ErrSink *err, DN_CallSite call_site, DN_U32 exit_val, DN_FMT_ATTRIB char const *fmt, va_list args);
|
||||
#define DN_ErrSinkEndExitIfErrorFV(err, exit_val, fmt, args) DN_ErrSinkEndExitIfErrorFV_(err, DN_CALL_SITE, exit_val, fmt, args)
|
||||
#define DN_ErrSinkEndExitIfErrorFV(err, exit_val, fmt, args) DN_ErrSinkEndExitIfErrorFV_(err, DN_CallSiteNow, exit_val, fmt, args)
|
||||
DN_API void DN_ErrSinkAppendFV_ (DN_ErrSink *err, DN_U32 error_code, DN_CallSite call_site, DN_FMT_ATTRIB char const *fmt, va_list args);
|
||||
#define DN_ErrSinkAppendFV(error, error_code, fmt, args) DN_ErrSinkAppendFV_(error, error_code, DN_CALL_SITE, fmt, args)
|
||||
#define DN_ErrSinkAppendFV(error, error_code, fmt, args) DN_ErrSinkAppendFV_(error, error_code, DN_CallSiteNow, fmt, args)
|
||||
DN_API void DN_ErrSinkAppendF_ (DN_ErrSink *err, DN_U32 error_code, DN_CallSite call_site, DN_FMT_ATTRIB char const *fmt, ...);
|
||||
#define DN_ErrSinkAppendF(error, error_code, fmt, ...) DN_ErrSinkAppendF_(error, error_code, DN_CALL_SITE, fmt, ##__VA_ARGS__)
|
||||
#define DN_ErrSinkAppendF(error, error_code, fmt, ...) DN_ErrSinkAppendF_(error, error_code, DN_CallSiteNow, fmt, ##__VA_ARGS__)
|
||||
|
||||
DN_API DN_TCInitArgs DN_TCInitArgsDefault ();
|
||||
DN_API void DN_TCInit (DN_TCCore *tc, DN_U64 thread_id, DN_Arena *main_arena, DN_Arena *temp_arenas, DN_USize temp_arenas_count, DN_Arena *err_sink_arena);
|
||||
@@ -4363,20 +4483,21 @@ DN_API DN_Str8 DN_Str8FromFmtANSIColourV3F32RGB255Arena
|
||||
// OS functionality enabled, the log callback is by default set to outputting via standard out.
|
||||
DN_API DN_LogPrefixSize DN_LogMakePrefix (DN_LogStyle style, DN_LogTypeParam type, DN_CallSite call_site, DN_LogDate date, char *dest, DN_USize dest_size);
|
||||
DN_API void DN_LogSetPrintFunc (DN_LogPrintFunc *print_func, void *user_data);
|
||||
DN_API void DN_LogPrint (DN_LogTypeParam type, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, ...);
|
||||
DN_API void DN_LogPrintF (DN_LogTypeParam type, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, ...);
|
||||
DN_API void DN_LogPrintFV (DN_LogTypeParam type, DN_CallSite call_site, DN_LogFlags flags, DN_FMT_ATTRIB char const *fmt, va_list args);
|
||||
DN_API DN_LogTypeParam DN_LogTypeParamFromType (DN_LogType type);
|
||||
#define DN_LogF(type, fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(type), DN_CALL_SITE, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogF(type, fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(type), DN_CallSiteNow, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
|
||||
#define DN_LogDebugF(fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Debug), DN_CALL_SITE, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogInfoF(fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Info), DN_CALL_SITE, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogWarningF(fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Warning), DN_CALL_SITE, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogErrorF(fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Error), DN_CALL_SITE, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogDebugF(fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(DN_LogType_Debug), DN_CallSiteNow, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogInfoF(fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(DN_LogType_Info), DN_CallSiteNow, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogWarningF(fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(DN_LogType_Warning), DN_CallSiteNow, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogErrorF(fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(DN_LogType_Error), DN_CallSiteNow, DN_LogFlags_Nil, fmt, ##__VA_ARGS__)
|
||||
|
||||
#define DN_LogFlagF(type, flags, fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(type), DN_CALL_SITE, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagDebugF(flags, fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Debug), DN_CALL_SITE, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagInfoF(flags, fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Info), DN_CALL_SITE, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagWarningF(flags, fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Warning), DN_CALL_SITE, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagErrorF(flags, fmt, ...) DN_LogPrint(DN_LogTypeParamFromType(DN_LogType_Error), DN_CALL_SITE, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagF(type, flags, fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(type), DN_CallSiteNow, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagDebugF(flags, fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(DN_LogType_Debug), DN_CallSiteNow, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagInfoF(flags, fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(DN_LogType_Info), DN_CallSiteNow, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagWarningF(flags, fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(DN_LogType_Warning), DN_CallSiteNow, flags, fmt, ##__VA_ARGS__)
|
||||
#define DN_LogFlagErrorF(flags, fmt, ...) DN_LogPrintF(DN_LogTypeParamFromType(DN_LogType_Error), DN_CallSiteNow, flags, fmt, ##__VA_ARGS__)
|
||||
|
||||
|
||||
// NOTE: OS primitives that the OS layer can provide for the base layer but is optional.
|
||||
@@ -4930,22 +5051,22 @@ DN_API DN_RaycastV2 DN_RaycastLineIntersectV2
|
||||
#define DN_PArrayMakeArray(ptr, ptr_size, max, count, z_mem) DN_TArrayMakeArray(ptr, ptr_size, max, count, z_mem)
|
||||
#define DN_PArrayMakeArrayZ(ptr, ptr_size, max, count) DN_TArrayMakeArray(ptr, ptr_size, max, count, DN_ZMem_Yes)
|
||||
#define DN_PArrayMakeArrayNoZ(ptr, ptr_size, max, count) DN_TArrayMakeArray(ptr, ptr_size, max, count, DN_ZMem_No)
|
||||
#define DN_PArrayMakeArrayAssert(ptr, ptr_size, max, count, z_mem) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, count, z_mem, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeArrayAssertZ(ptr, ptr_size, max, count) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, count, DN_ZMem_Yes, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeArrayAssertNoZ(ptr, ptr_size, max, count) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, count, DN_ZMem_No, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeArrayAssert(ptr, ptr_size, max, count, z_mem) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, count, z_mem, DN_CallSiteNow)
|
||||
#define DN_PArrayMakeArrayAssertZ(ptr, ptr_size, max, count) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, count, DN_ZMem_Yes, DN_CallSiteNow)
|
||||
#define DN_PArrayMakeArrayAssertNoZ(ptr, ptr_size, max, count) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, count, DN_ZMem_No, DN_CallSiteNow)
|
||||
|
||||
#define DN_PArrayMake(ptr, ptr_size, max, z_mem) DN_TArrayMakeArray(ptr, ptr_size, max, 1, z_mem)
|
||||
#define DN_PArrayMakeZ(ptr, ptr_size, max) DN_TArrayMakeArray(ptr, ptr_size, max, 1, DN_ZMem_Yes)
|
||||
#define DN_PArrayMakeNoZ(ptr, ptr_size, max) DN_TArrayMakeArray(ptr, ptr_size, max, 1, DN_ZMem_No)
|
||||
#define DN_PArrayMakeAssert(ptr, ptr_size, max, z_mem) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, 1, z_mem, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeAssertZ(ptr, ptr_size, max) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, 1, DN_ZMem_Yes, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeAssertNoZ(ptr, ptr_size, max) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, 1, DN_ZMem_No, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeAssert(ptr, ptr_size, max, z_mem) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, 1, z_mem, DN_CallSiteNow)
|
||||
#define DN_PArrayMakeAssertZ(ptr, ptr_size, max) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, 1, DN_ZMem_Yes, DN_CallSiteNow)
|
||||
#define DN_PArrayMakeAssertNoZ(ptr, ptr_size, max) DN_TArrayMakeArrayAssert(ptr, ptr_size, max, 1, DN_ZMem_No, DN_CallSiteNow)
|
||||
|
||||
#define DN_PArrayAddArray(ptr, ptr_size, max, items, count, add) DN_TArrayAddArray(ptr, ptr_size, max, items, count, add)
|
||||
#define DN_PArrayAdd(ptr, ptr_size, max, item, add) DN_TArrayAddArray(ptr, ptr_size, max, &item, 1, add)
|
||||
#define DN_PArrayAppendArray(ptr, ptr_size, max, items, count) DN_TArrayAddArray(ptr, ptr_size, max, items, count, DN_ArrayAdd_Append)
|
||||
#define DN_PArrayAppend(ptr, ptr_size, max, item) DN_TArrayAddArray(ptr, ptr_size, max, &item, 1, DN_ArrayAdd_Append)
|
||||
#define DN_PArrayAppendAssert(ptr, ptr_size, max, item) DN_TArrayAddArrayAssert(ptr, ptr_size, max, &item, 1, DN_ArrayAdd_Append, DN_CALL_SITE)
|
||||
#define DN_PArrayAppendAssert(ptr, ptr_size, max, item) DN_TArrayAddArrayAssert(ptr, ptr_size, max, &item, 1, DN_ArrayAdd_Append, DN_CallSiteNow)
|
||||
#define DN_PArrayPrependArray(ptr, ptr_size, max, items, count) DN_TArrayAddArray(ptr, ptr_size, max, items, count, DN_ArrayAdd_Prepend)
|
||||
#define DN_PArrayPrepend(ptr, ptr_size, max, item) DN_TArrayAddArray(ptr, ptr_size, max, &item, 1, DN_ArrayAdd_Prepend)
|
||||
|
||||
@@ -4968,22 +5089,22 @@ DN_API DN_RaycastV2 DN_RaycastLineIntersectV2
|
||||
#define DN_PArrayMakeArray(ptr, ptr_size, max, count, z_mem) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArray(ptr, ptr_size, max, sizeof((ptr)[0]), count, z_mem)
|
||||
#define DN_PArrayMakeArrayZ(ptr, ptr_size, max, count) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArray(ptr, ptr_size, max, sizeof((ptr)[0]), count, DN_ZMem_Yes)
|
||||
#define DN_PArrayMakeArrayNoZ(ptr, ptr_size, max, count) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArray(ptr, ptr_size, max, sizeof((ptr)[0]), count, DN_ZMem_No)
|
||||
#define DN_PArrayMakeArrayAssert(ptr, ptr_size, max, count, z_mem) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), count, z_mem, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeArrayAssertZ(ptr, ptr_size, max, count) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), count, DN_ZMem_Yes, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeArrayAssertNoZ(ptr, ptr_size, max, count) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), count, DN_ZMem_No, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeArrayAssert(ptr, ptr_size, max, count, z_mem) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), count, z_mem, DN_CallSiteNow)
|
||||
#define DN_PArrayMakeArrayAssertZ(ptr, ptr_size, max, count) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), count, DN_ZMem_Yes, DN_CallSiteNow)
|
||||
#define DN_PArrayMakeArrayAssertNoZ(ptr, ptr_size, max, count) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), count, DN_ZMem_No, DN_CallSiteNow)
|
||||
|
||||
#define DN_PArrayMake(ptr, ptr_size, max, z_mem) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArray(ptr, ptr_size, max, sizeof((ptr)[0]), 1, z_mem)
|
||||
#define DN_PArrayMakeZ(ptr, ptr_size, max) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArray(ptr, ptr_size, max, sizeof((ptr)[0]), 1, DN_ZMem_Yes)
|
||||
#define DN_PArrayMakeNoZ(ptr, ptr_size, max) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArray(ptr, ptr_size, max, sizeof((ptr)[0]), 1, DN_ZMem_No)
|
||||
#define DN_PArrayMakeAssert(ptr, ptr_size, max, z_mem) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), 1, z_mem, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeAssertZ(ptr, ptr_size, max) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), 1, DN_ZMem_Yes, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeAssertNoZ(ptr, ptr_size, max) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), 1, DN_ZMem_No, DN_CALL_SITE)
|
||||
#define DN_PArrayMakeAssert(ptr, ptr_size, max, z_mem) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), 1, z_mem, DN_CallSiteNow)
|
||||
#define DN_PArrayMakeAssertZ(ptr, ptr_size, max) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), 1, DN_ZMem_Yes, DN_CallSiteNow)
|
||||
#define DN_PArrayMakeAssertNoZ(ptr, ptr_size, max) (DN_CppDeclType(&(ptr)[0]))DN_ArrayMakeArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), 1, DN_ZMem_No, DN_CallSiteNow)
|
||||
|
||||
#define DN_PArrayAddArray(ptr, ptr_size, max, items, count, add) (DN_CppDeclType(&(ptr)[0]))DN_ArrayAddArray(ptr, ptr_size, max, sizeof((ptr)[0]), items, count, add)
|
||||
#define DN_PArrayAdd(ptr, ptr_size, max, item, add) (DN_CppDeclType(&(ptr)[0]))DN_ArrayAddArray(ptr, ptr_size, max, sizeof((ptr)[0]), &item, 1, add)
|
||||
#define DN_PArrayAppendArray(ptr, ptr_size, max, items, count) (DN_CppDeclType(&(ptr)[0]))DN_ArrayAddArray(ptr, ptr_size, max, sizeof((ptr)[0]), items, count, DN_ArrayAdd_Append)
|
||||
#define DN_PArrayAppend(ptr, ptr_size, max, item) (DN_CppDeclType(&(ptr)[0]))DN_ArrayAddArray(ptr, ptr_size, max, sizeof((ptr)[0]), &item, 1, DN_ArrayAdd_Append)
|
||||
#define DN_PArrayAppendAssert(ptr, ptr_size, max, item) (DN_CppDeclType(&(ptr)[0]))DN_ArrayAddArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), &item, 1, DN_ArrayAdd_Append, DN_CALL_SITE)
|
||||
#define DN_PArrayAppendAssert(ptr, ptr_size, max, item) (DN_CppDeclType(&(ptr)[0]))DN_ArrayAddArrayAssert(ptr, ptr_size, max, sizeof((ptr)[0]), &item, 1, DN_ArrayAdd_Append, DN_CallSiteNow)
|
||||
#define DN_PArrayPrependArray(ptr, ptr_size, max, items, count) (DN_CppDeclType(&(ptr)[0]))DN_ArrayAddArray(ptr, ptr_size, max, sizeof((ptr)[0]), items, count, DN_ArrayAdd_Prepend)
|
||||
#define DN_PArrayPrepend(ptr, ptr_size, max, item) (DN_CppDeclType(&(ptr)[0]))DN_ArrayAddArray(ptr, ptr_size, max, sizeof((ptr)[0]), &item, 1, DN_ArrayAdd_Prepend)
|
||||
|
||||
@@ -5392,7 +5513,7 @@ DN_API void DN_LeakDump_ (DN_LeakTracker *leak);
|
||||
|
||||
// NOTE: Template implementations
|
||||
#if defined(__cplusplus)
|
||||
template <typename T> T *DN_TMemCopyObj(T *dest, T const *src, DN_USize count)
|
||||
template <typename T> T *DN_MemCopyObjT(T *dest, T const *src, DN_USize count)
|
||||
{
|
||||
T* result = dest;
|
||||
DN_Memcpy(dest, src, sizeof(T) * count);
|
||||
|
||||
Reference in New Issue
Block a user