[brlcad-commits] SF.net SVN: brlcad:[33559] brlcad/trunk/include/bu.h
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2009-01-16 00:35:06
|
Revision: 33559 http://brlcad.svn.sourceforge.net/brlcad/?rev=33559&view=rev Author: brlcad Date: 2009-01-16 00:35:02 +0000 (Fri, 16 Jan 2009) Log Message: ----------- rewrite the implementation of BU_BITV_ZEROALL to manually zero the bytes of the bit vector so that we don't call memset directly. that way we don't have to require string.h and make the function call. Modified Paths: -------------- brlcad/trunk/include/bu.h Modified: brlcad/trunk/include/bu.h =================================================================== --- brlcad/trunk/include/bu.h 2009-01-14 21:29:56 UTC (rev 33558) +++ brlcad/trunk/include/bu.h 2009-01-16 00:35:02 UTC (rev 33559) @@ -1027,11 +1027,20 @@ ((_bv)->bits[(bit)>>BU_BITV_SHIFT] &= ~(((bitv_t)1)<<((bit)&BU_BITV_MASK))) /** - * requires #include <string.h> + * zeros all of the internal storage bytes in a bit vector array */ #define BU_BITV_ZEROALL(_bv) \ - { memset((char *)((_bv)->bits), 0, BU_BITS2BYTES( (_bv)->nbits )); } +{ \ + if ((_bv) && (_bv)->nbits != 0) { \ + unsigned char *bvp = (unsigned char *)(_bv)->bits; \ + size_t nbytes = BU_BITS2BYTES((_bv)->nbits); \ + do { \ + *bvp++ = (unsigned char)0; \ + } while (--nbytes != 0); \ + } \ +} + /* This is not done by default for performance reasons */ #ifdef NO_BOMBING_MACROS # define BU_BITV_BITNUM_CHECK(_bv, _bit) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |