diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-18 05:09:59 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-18 05:09:59 +0300 |
commit | faafd4634a7083fdf4c9dee04433559c9e437a04 (patch) | |
tree | cd40ffb37881d55190cae93efb3dc69a71c337d5 /source/blender/blenlib/BLI_utildefines.h | |
parent | 25d4515181d0d5af9369cb532fbb0accdbd1d4f6 (diff) |
fix for error in r35590, ARRAY_LAST_ITEM was returning one item over the end of the array.
Diffstat (limited to 'source/blender/blenlib/BLI_utildefines.h')
-rw-r--r-- | source/blender/blenlib/BLI_utildefines.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index eff70b46157..55f227f0284 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -131,7 +131,7 @@ #define IN_RANGE_INCL(a, b, c) ((b < c)? ((b<=a && a<=c)? 1:0) : ((c<=a && a<=b)? 1:0)) /* array helpers */ -#define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) (arr_dtype *)((char*)arr_start + (elem_size*tot)) +#define ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot) (arr_dtype *)((char*)arr_start + (elem_size*(tot - 1))) #define ARRAY_HAS_ITEM(item, arr_start, arr_dtype, elem_size, tot) ((item >= arr_start) && (item <= ARRAY_LAST_ITEM(arr_start, arr_dtype, elem_size, tot))) /* This one rotates the bytes in an int64, int (32) and short (16) */ |