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

Commit15a3c33

Browse files
committed
Change MemSet to use long instead of int32, for better performance on
64-bit platforms.by ITAGAKI Takahiro
1 parent422998d commit15a3c33

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

‎src/include/c.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $PostgreSQL: pgsql/src/include/c.h,v 1.195 2006/02/03 13:53:15 momjian Exp $
15+
* $PostgreSQL: pgsql/src/include/c.h,v 1.196 2006/02/16 23:23:50 petere Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -603,8 +603,8 @@ typedef NameData *Name;
603603
} while (0)
604604

605605

606-
/* Get a bit mask of the bits set in non-int32 aligned addresses */
607-
#defineINT_ALIGN_MASK (sizeof(int32) - 1)
606+
/* Get a bit mask of the bits set in non-long aligned addresses */
607+
#defineLONG_ALIGN_MASK (sizeof(long) - 1)
608608

609609
/*
610610
* MemSet
@@ -624,8 +624,8 @@ typedef NameData *Name;
624624
int_val= (val); \
625625
Size_len= (len); \
626626
\
627-
if ((((long)_vstart)&INT_ALIGN_MASK)==0&& \
628-
(_len&INT_ALIGN_MASK)==0&& \
627+
if ((((long)_vstart)&LONG_ALIGN_MASK)==0&& \
628+
(_len&LONG_ALIGN_MASK)==0&& \
629629
_val==0&& \
630630
_len <=MEMSET_LOOP_LIMIT&& \
631631
/* \
@@ -634,8 +634,8 @@ typedef NameData *Name;
634634
*/ \
635635
MEMSET_LOOP_LIMIT!=0) \
636636
{ \
637-
int32*_start= (int32*)_vstart; \
638-
int32*_stop= (int32*) ((char*)_start+_len); \
637+
long*_start= (long*)_vstart; \
638+
long*_stop= (long*) ((char*)_start+_len); \
639639
while (_start<_stop) \
640640
*_start++=0; \
641641
} \
@@ -652,16 +652,16 @@ typedef NameData *Name;
652652
#defineMemSetAligned(start,val,len) \
653653
do \
654654
{ \
655-
int32*_start = (int32 *) (start); \
655+
long*_start = (long *) (start); \
656656
int_val = (val); \
657657
Size_len = (len); \
658658
\
659-
if ((_len &INT_ALIGN_MASK) == 0 && \
659+
if ((_len &LONG_ALIGN_MASK) == 0 && \
660660
_val == 0 && \
661661
_len <= MEMSET_LOOP_LIMIT && \
662662
MEMSET_LOOP_LIMIT != 0) \
663663
{ \
664-
int32 *_stop = (int32 *) ((char *) _start + _len); \
664+
long *_stop = (long *) ((char *) _start + _len); \
665665
while (_start < _stop) \
666666
*_start++ = 0; \
667667
} \
@@ -679,16 +679,16 @@ typedef NameData *Name;
679679
* this approach.
680680
*/
681681
#defineMemSetTest(val,len) \
682-
( ((len) &INT_ALIGN_MASK) == 0 && \
682+
( ((len) &LONG_ALIGN_MASK) == 0 && \
683683
(len) <= MEMSET_LOOP_LIMIT && \
684684
MEMSET_LOOP_LIMIT != 0 && \
685685
(val) == 0 )
686686

687687
#defineMemSetLoop(start,val,len) \
688688
do \
689689
{ \
690-
int32 * _start = (int32 *) (start); \
691-
int32 * _stop = (int32 *) ((char *) _start + (Size) (len)); \
690+
long * _start = (long *) (start); \
691+
long * _stop = (long *) ((char *) _start + (Size) (len)); \
692692
\
693693
while (_start < _stop) \
694694
*_start++ = 0; \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp