https://github.com/halide/Halide
Raw File
Tip revision: e4222b5e49a53a300c3f5db1299f2cdf44c040d9 authored by Shoaib Kamil on 19 October 2018, 22:17:07 UTC
Also handle neg inf
Tip revision: e4222b5
destructors.cpp
#include "HalideRuntime.h"

#define INLINE inline __attribute__((weak)) __attribute__((always_inline)) __attribute__((used))

extern "C" {

INLINE void call_destructor(void *user_context, void (*fn)(void *user_context, void *object), void **object, bool should_call) {
    void *o = *object;
    *object = NULL;
    // Call the function
    if (o && should_call) {
        fn(user_context, o);
    }
}

}
back to top