Skip to content

Commit

Permalink
Fix check for Windows never having aligned_alloc available. (#8551)
Browse files Browse the repository at this point in the history
Fix check for Windows having aligned_alloc available.
  • Loading branch information
mcourteaux authored Jan 10, 2025
1 parent 14ff545 commit c440596
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/runtime/HalideBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ static_assert(((HALIDE_RUNTIME_BUFFER_ALLOCATION_ALIGNMENT & (HALIDE_RUNTIME_BUF
#ifndef HALIDE_RUNTIME_BUFFER_USE_ALIGNED_ALLOC

// clang-format off
#ifdef _MSC_VER
#ifdef _WIN32

// MSVC doesn't implement aligned_alloc(), even in C++17 mode, and
// has stated they probably never will, so, always default it off here.
// Windows (regardless of which compiler) doesn't implement aligned_alloc(),
// even in C++17 mode, and has stated they probably never will, as the issue
// is in the incompatibility that free() needs to be able to free both pointers
// returned by malloc() and aligned_alloc(). So, always default it off here.
#define HALIDE_RUNTIME_BUFFER_USE_ALIGNED_ALLOC 0

#elif defined(__ANDROID_API__) && __ANDROID_API__ < 28
Expand Down

0 comments on commit c440596

Please sign in to comment.