Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit79cb0fd

Browse files
committed
Cleanup for memset macro.
1 parent220941d commit79cb0fd

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎src/include/c.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: c.h,v 1.20 1997/09/1814:20:40 momjian Exp $
10+
* $Id: c.h,v 1.21 1997/09/1817:06:21 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -698,10 +698,18 @@ typedef struct Exception
698698
/* This function gets call too often, so we inline it if we can */
699699
#defineMemSet(start,val,len)do \
700700
{/* 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&& \
702704
((len)&INT_ALIGN_MASK)==0&& \
703705
(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) \
705713
{ \
706714
int32*i= (int32*)(start); \
707715
int32*stop= (int32*)((char*)(start)+ (len)); \
@@ -711,7 +719,7 @@ typedef struct Exception
711719
} \
712720
else \
713721
memset((start), (val), (len)); \
714-
}
722+
}while (0)
715723

716724
/* ----------------------------------------------------------------
717725
*Section 9: externs

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp