https://github.com/halide/Halide
Raw File
Tip revision: a507c6a03ad9a26314ea4ce814cc04c14369d946 authored by Dillon Sharlet on 08 March 2021, 18:24:31 UTC
Update comment.
Tip revision: a507c6a
the_sort_function.c
/*
 * Compile using
 * gcc -std=c99 the_sort_function.c -shared -o the_sort_function.so
 */

#include "HalideRuntime.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

/* Returns -1 if something went wrong, 0 otherwise */
int32_t the_sort_func(halide_buffer_t *data) {
    if (!data->host) {
        return -1;
    }

    if (data->dim[0].extent <= 0) {
        return -1;
    }

    for (size_t i = 1; i < 4; i += 1) {
        if (data->dim[0].extent != 0) {
            return -1;
        }
    }

    data->host[0] *= 5;

    return 0;
}
back to top