1 /* -*- mode: c; tab-width: 4; fill-column: 128 -*- */
2 /* vi: set ts=4 tw=128: */
5 aligned_malloc.h, Copyright (c) 2014 Dave Odell <dmo2118@gmail.com>
7 Permission to use, copy, modify, distribute, and sell this software and its
8 documentation for any purpose is hereby granted without fee, provided that
9 the above copyright notice appear in all copies and that both that
10 copyright notice and this permission notice appear in supporting
11 documentation. No representations are made about the suitability of this
12 software for any purpose. It is provided "as is" without express or
16 #ifndef __ALIGNED_MALLOC_H__
17 #define __ALIGNED_MALLOC_H__
25 #if _POSIX_VERSION >= 200112L || _XOPEN_VERSION >= 600
27 # define aligned_malloc posix_memalign
28 # define aligned_free free
32 /* This can't simply be named posix_memalign, since the real thing uses
33 free(), but this one can't. */
34 int aligned_malloc(void **ptr, unsigned alignment, size_t size);
35 void aligned_free(void *);
37 #endif /* old POSIX */
39 #endif /* __ALIGNED_MALLOC_H__ */