Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_utildefines.h
| Show First 20 Lines • Show All 405 Lines • ▼ Show 20 Lines | |||||
| #define ARRAY_DELETE(arr, index, tot_delete, tot) { \ | #define ARRAY_DELETE(arr, index, tot_delete, tot) { \ | ||||
| BLI_assert(index + tot_delete <= tot); \ | BLI_assert(index + tot_delete <= tot); \ | ||||
| memmove(&(arr)[(index)], \ | memmove(&(arr)[(index)], \ | ||||
| &(arr)[(index) + (tot_delete)], \ | &(arr)[(index) + (tot_delete)], \ | ||||
| (((tot) - (index)) - (tot_delete)) * sizeof(*(arr))); \ | (((tot) - (index)) - (tot_delete)) * sizeof(*(arr))); \ | ||||
| } (void)0 | } (void)0 | ||||
| /* assuming a static array */ | /* assuming a static array */ | ||||
| #if defined(__GNUC__) && !defined(__cplusplus) && !defined(__clang__) | #if defined(__GNUC__) && !defined(__cplusplus) && !defined(__clang__) && !defined(__INTEL_COMPILER) | ||||
| # define ARRAY_SIZE(arr) \ | # define ARRAY_SIZE(arr) \ | ||||
| ((sizeof(struct {int isnt_array : ((const void *)&(arr) == &(arr)[0]);}) * 0) + \ | ((sizeof(struct {int isnt_array : ((const void *)&(arr) == &(arr)[0]);}) * 0) + \ | ||||
| (sizeof(arr) / sizeof(*(arr)))) | (sizeof(arr) / sizeof(*(arr)))) | ||||
| #else | #else | ||||
| # define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr))) | # define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr))) | ||||
| #endif | #endif | ||||
| /* ARRAY_SET_ITEMS#(v, ...): set indices of array 'v' */ | /* ARRAY_SET_ITEMS#(v, ...): set indices of array 'v' */ | ||||
| ▲ Show 20 Lines • Show All 208 Lines • Show Last 20 Lines | |||||