diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-02-13 23:28:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-02-14 00:00:41 +0300 |
commit | 7a977df6d4763033388d27453ccf502d00fcf23c (patch) | |
tree | 93e237b7b605a948f15a382ddf0b8f9313ceee01 /source/blender/blenlib/BLI_array_utils.h | |
parent | 2af905391d6c5e238751b0dd4ce9f766668fcea2 (diff) |
Refactor array_utils out of BLI_array
BLI_array.h is for resizing array macros, where as array_utils can operate on any arrays.
Diffstat (limited to 'source/blender/blenlib/BLI_array_utils.h')
-rw-r--r-- | source/blender/blenlib/BLI_array_utils.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h new file mode 100644 index 00000000000..0dd1439e58c --- /dev/null +++ b/source/blender/blenlib/BLI_array_utils.h @@ -0,0 +1,41 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef __BLI_ARRAY_UTILS_H__ +#define __BLI_ARRAY_UTILS_H__ + +/** \file BLI_array_utils.h + * \ingroup bli + * \brief Generic array manipulation API. + */ + +void _bli_array_reverse(void *arr, unsigned int arr_len, size_t arr_stride); +#define BLI_array_reverse(arr, arr_len) \ + _bli_array_reverse(arr, arr_len, sizeof(*(arr))) + +void _bli_array_wrap(void *arr, unsigned int arr_len, size_t arr_stride, int dir); +#define BLI_array_wrap(arr, arr_len, dir) \ + _bli_array_wrap(arr, arr_len, sizeof(*(arr)), dir) + +int _bli_array_findindex(const void *arr, unsigned int arr_len, size_t arr_stride, const void *p); +#define BLI_array_findindex(arr, arr_len, p) \ + _bli_array_findindex(arr, arr_len, sizeof(*(arr)), p) + +#endif /* __BLI_ARRAY_UTILS_H__ */ |