Fix Windows failures.
parent
f75fc1e881
commit
1c09a90b68
|
@ -15,12 +15,14 @@ static thread_local O1HeapInstance* Instance_ = NULL;
|
||||||
void codec2_initialize_realtime(size_t heapSize)
|
void codec2_initialize_realtime(size_t heapSize)
|
||||||
{
|
{
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
Heap_ = (void*)_aligned_malloc(O1HEAP_ALIGNMENT, heapSize);
|
Heap_ = (void*)_aligned_malloc(heapSize, O1HEAP_ALIGNMENT);
|
||||||
#else
|
#else
|
||||||
Heap_ = (void*)aligned_alloc(O1HEAP_ALIGNMENT, heapSize);
|
Heap_ = (void*)aligned_alloc(O1HEAP_ALIGNMENT, heapSize);
|
||||||
#endif // defined(WIN32)
|
#endif // defined(WIN32)
|
||||||
assert(Heap_ != NULL);
|
assert(Heap_ != NULL);
|
||||||
|
|
||||||
|
memset(Heap_, 0, heapSize);
|
||||||
|
|
||||||
Instance_ = o1heapInit(Heap_, heapSize);
|
Instance_ = o1heapInit(Heap_, heapSize);
|
||||||
assert(Instance_ != NULL);
|
assert(Instance_ != NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,10 @@
|
||||||
/// computation, which is available via compiler intrinsics. The default implementation will automatically use
|
/// computation, which is available via compiler intrinsics. The default implementation will automatically use
|
||||||
/// the intrinsics for some of the compilers; for others it will default to the slow software emulation,
|
/// the intrinsics for some of the compilers; for others it will default to the slow software emulation,
|
||||||
/// which can be overridden by the user via O1HEAP_CONFIG_HEADER. The library guarantees that the argument is positive.
|
/// which can be overridden by the user via O1HEAP_CONFIG_HEADER. The library guarantees that the argument is positive.
|
||||||
|
///
|
||||||
|
/// NOTE (MS, 2025-06-04): __builtin_clzl seems broken on LLVM MinGW, so reverting to slower emulation on Windows.
|
||||||
#if O1HEAP_USE_INTRINSICS && !defined(O1HEAP_CLZ)
|
#if O1HEAP_USE_INTRINSICS && !defined(O1HEAP_CLZ)
|
||||||
# if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
|
# if !defined(WIN32) && (defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM))
|
||||||
# define O1HEAP_CLZ __builtin_clzl
|
# define O1HEAP_CLZ __builtin_clzl
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue