7
7
*
8
8
* Copyright (c) 1994, Regents of the University of California
9
9
*
10
- * $Id: c.h,v 1.20 1997/09/18 14:20:40 momjian Exp $
10
+ * $Id: c.h,v 1.21 1997/09/18 17:06:21 momjian Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -698,10 +698,18 @@ typedef struct Exception
698
698
/* This function gets call too often, so we inline it if we can */
699
699
#define MemSet (start , val , len ) do \
700
700
{ /* are we aligned for int32? */ \
701
- if (((start) & INT_ALIGN_MASK) == 0 && \
701
+ /* We have to cast the pointer to int \
702
+ so we can do the AND */ \
703
+ if (((int )(start ) & INT_ALIGN_MASK ) == 0 && \
702
704
((len ) & INT_ALIGN_MASK ) == 0 && \
703
705
(val ) == 0 && \
704
- (len) <= 256) \
706
+ /* \
707
+ * We got this number by testing this \
708
+ * against the stock memset() on \
709
+ * bsd/os 3.0. Larger values were \
710
+ * slower. \
711
+ */ \
712
+ (len ) <= 64 ) \
705
713
{ \
706
714
int32 * i = (int32 * )(start ); \
707
715
int32 * stop = (int32 * )((char * )(start ) + (len )); \
@@ -711,7 +719,7 @@ typedef struct Exception
711
719
} \
712
720
else \
713
721
memset ((start ), (val ), (len )); \
714
- }
722
+ } while ( 0 )
715
723
716
724
/* ----------------------------------------------------------------
717
725
* Section 9: externs
0 commit comments