diff options
author | Bruce Momjian <bruce@momjian.us> | 1997-09-18 17:06:21 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1997-09-18 17:06:21 +0000 |
commit | 79cb0fd9bb46c5c8703da28d5dc0974f05765e91 (patch) | |
tree | bf64dedeb8161f2fa45fa4c4728a4379b1a88668 /src | |
parent | 220941dac56019c8f01b67f1801c83eee0c6052e (diff) | |
download | postgresql-79cb0fd9bb46c5c8703da28d5dc0974f05765e91.tar.gz postgresql-79cb0fd9bb46c5c8703da28d5dc0974f05765e91.zip |
Cleanup for memset macro.
Diffstat (limited to 'src')
-rw-r--r-- | src/include/c.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/include/c.h b/src/include/c.h index b247b2e8fa2..8f0fae3b6d5 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: c.h,v 1.20 1997/09/18 14:20:40 momjian Exp $ + * $Id: c.h,v 1.21 1997/09/18 17:06:21 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -698,10 +698,18 @@ typedef struct Exception /* This function gets call too often, so we inline it if we can */ #define MemSet(start, val, len) do \ { /* are we aligned for int32? */ \ - if (((start) & INT_ALIGN_MASK) == 0 && \ + /* We have to cast the pointer to int \ + so we can do the AND */ \ + if (((int)(start) & INT_ALIGN_MASK) == 0 && \ ((len) & INT_ALIGN_MASK) == 0 && \ (val) == 0 && \ - (len) <= 256) \ + /* \ + * We got this number by testing this \ + * against the stock memset() on \ + * bsd/os 3.0. Larger values were \ + * slower. \ + */ \ + (len) <= 64) \ { \ int32 *i = (int32 *)(start); \ int32 *stop = (int32 *)((char *)(start) + (len)); \ @@ -711,7 +719,7 @@ typedef struct Exception } \ else \ memset((start), (val), (len)); \ - } + } while (0) /* ---------------------------------------------------------------- * Section 9: externs |