[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35605] trunk/blender/source/blender/ blenlib/BLI_utildefines.h: fix for error in r35590, ARRAY_LAST_ITEM was returning one item over the end of the array.
Campbell Barton
ideasman42 at gmail.com
Fri Mar 18 03:10:01 CET 2011
Revision: 35605
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35605
Author: campbellbarton
Date: 2011-03-18 02:09:59 +0000 (Fri, 18 Mar 2011)
Log Message:
-----------
fix for error in r35590, ARRAY_LAST_ITEM was returning one item over the end of the array.
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35590
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_utildefines.h
Modified: trunk/blender/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_utildefines.h 2011-03-18 00:12:51 UTC (rev 35604)
+++ trunk/blender/source/blender/blenlib/BLI_utildefines.h 2011-03-18 02:09:59 UTC (rev 35605)
@@ -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) */
More information about the Bf-blender-cvs
mailing list