diff options
| author | Bruce Momjian | 1997-09-18 14:21:02 +0000 |
|---|---|---|
| committer | Bruce Momjian | 1997-09-18 14:21:02 +0000 |
| commit | 8cb415449202d7804c6a557352a91d0401ab1c19 (patch) | |
| tree | 44acc47d6a50fa83667fdb4e9ad4e1bb81d61a0a /src/include/c.h | |
| parent | bbe2c10c140803881125c516bcc172363eb698d8 (diff) | |
Inline frequently called functions.
Diffstat (limited to 'src/include/c.h')
| -rw-r--r-- | src/include/c.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/include/c.h b/src/include/c.h index 05c3cc5e923..b247b2e8fa2 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.19 1997/09/08 21:50:24 momjian Exp $ + * $Id: c.h,v 1.20 1997/09/18 14:20:40 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -692,6 +692,27 @@ typedef struct Exception /* we do this so if the macro is used in an if action, it will work */ #define strNcpy(dst,src,len) (strncpy((dst),(src),(len)),*((dst)+(len))='\0') +/* Get a bit mask of the bits set in non-int32 aligned addresses */ +#define INT_ALIGN_MASK (sizeof(int32) - 1) + +/* 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 && \ + ((len) & INT_ALIGN_MASK) == 0 && \ + (val) == 0 && \ + (len) <= 256) \ + { \ + int32 *i = (int32 *)(start); \ + int32 *stop = (int32 *)((char *)(start) + (len)); \ + \ + while (i < stop) \ + *i++ = 0; \ + } \ + else \ + memset((start), (val), (len)); \ + } + /* ---------------------------------------------------------------- * Section 9: externs * ---------------------------------------------------------------- |
