亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cm_hash.c

?? 中國石油二期加油站IC系統后臺通訊軟件
?? C
?? 第 1 頁 / 共 3 頁
字號:


/********************************************************************20**
  
     Name:     common hash functions
  
     Type:     C source file
  
     Desc:     Hashing functions used by various layers.
               (Newer version of functions in cm_bdy1)
  
               Using hash lists in a product:
               ------------------------------

               Wherever a hash list is needed, a corresponding hash list
               control point (CmHashListCp) should be declared. The structure 
               definition of the entries that belong to the hash list must 
               include a declaration of the hash list entry header
               (CmHashListEnt) along with the key for the hash list (this
               may be any scalar or structure type subfield of the entry).
               For example, we need a hash list in a SAP to maintain a table
               of addresses:

               typedef struct xySAPCb       (SAP control block)
               {
                  ...
                  CmHashListCp addrHlCp;    (hash list for addresses)
                  ...
               } XySAPCb;

               typedef struct xyAddrEnt     (hash list entry for an address)
               {
                  ...
                  CmHashListEnt hl;         (hash list entry header)
                  ...
                  XyAddr addr;              (hash list key)
                  ...
               } XyAddrEnt;

               Functions available:
               --------------------

               The functions available for using hash lists are defined
               below. The accompanying comments explain the usage in detail.

               Implementation details:
               -----------------------

               A hash list is identified by its control point
               (CmHashListCp). This control point stores the characteristics
               of the hash list as well as a pointer to the hash list bins.
               The storage for the bins is allocated when the hash list is
               initialized. Each bin is organized as a doubly linked list of
               entries whose key maps to this bin. The hash function used to
               map keys to a bin simply adds up all the octets of the key
               and then divides the sum by the number of bins. Variable size
               keys are allowed. Duplicate keys may be present if explicitly
               allowed; if so, they can be retrieved by supplying a sequence
               number in the find routine. A given structure may be attached
               to more than one hash list if it contains multiple hash list
               entry header fields.

     File:     cm_hash.c
  
     Sid:      cm_hash.c 1.11  -  02/11/00 11:55:45
 
     Prg:      rg
  
*********************************************************************21*/
  
  
/* header include files -- defines (.h) */

#include "envopt.h"        /* environment options */
#include "envdep.h"        /* environment dependent */
#include "envind.h"        /* environment independent */

#include "gen.h"           /* general */
#include "ssi.h"           /* system services */
#include "cm_hash.h"       /* common hash functions */
#include "cm_err.h"        /* common functions error */

/* header include -- typedef structs (.x) */

#include "gen.x"           /* general */
#include "ssi.x"           /* system services */
#include "cm_lib.x"        /* common library functions */
#include "cm_hash.x"       /* common hash functions */


/* local defines */

/* local externs */

/* forward references */

PRIVATE S16 cmHashFuncString  ARGS((CmHashListCp *hashListCp, U8 *key, 
                                         U16 keyLen, U16 *idx));

PRIVATE S16 cmHashFuncDefault ARGS((CmHashListCp *hashListCp, U8 *key, 
                                         U16 keyLen, U16 *idx));

PRIVATE S16 cmHashMatchKey ARGS((U8 *key1, U16 keyLen1, U8 *key2, U16 keyLen2));
PRIVATE S16 cmListInsert   ARGS((CmListEnt *oldEntry, CmListEnt *newEntry));
PRIVATE S16 cmListDelete   ARGS((CmListEnt *entry));

/* functions in other modules */
  
/* public variable declarations */

/* private variable declarations */


/*
 *     private support functions
 */


/*
*
*       Fun:   cmHashFuncString
*
*       Desc:  Computes the hash list index (bin number) for a specified
*              key of type CM_HASH_KEYTYPE_STR. 
*
*              for (length of string)
*                 idx = (31 * idx) + *string;
*
*              return (idx % hash_table_size);
*
*       Ret:   ROK     - successful, *idx contains computed index 
*
*       Notes: None.
*
*       File:  cm_hash.c
*
*/

#ifdef ANSI
PRIVATE S16 cmHashFuncString
(
CmHashListCp       *hashListCp,        /* hash list control point */
U8                 *key,               /* key string */
U16                keyLen,             /* length of key string */
U16                *idx                /* idx to return */
) 
#else
PRIVATE S16 cmHashFuncString (hashListCp, key, keyLen, idx)
CmHashListCp       *hashListCp;        /* hash list control point */
U8                 *key;               /* key string */
U16                keyLen;             /* length of key string */
U16                *idx;               /* idx to return */
#endif
{
   U16             cntr;               /* Index */
   U32             sum;                /* Sum of octets for hash function */

   TRC2(cmHashFuncString)

   sum = 0;

   for (cntr = 0; cntr < keyLen; cntr++)
   {
      sum = (CM_STR_HASHFUNC_CONSTANT * sum) + key[cntr];
   }

   /* if nmbBins is a power of 2, use shift, else use division */
   if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
      *idx = (U16) (sum & hashListCp->binBitMask);
   else
      *idx = (U16) (sum % hashListCp->nmbBins);

   RETVALUE(ROK);

} /* end of cmHashFuncString () */


  
/*
*
*       Fun:   cmHashFuncDefault
*
*       Desc:  Computes the hash list index (bin number) for a specified
*              key of type CM_HASH_KEYTYPE_DEF. 
*
*              Adds up all the octets of the key string
*              and divides the sum by the range to get the desired index.
*
*       Ret:   ROK     - successful, *idx contains computed index 
*
*       Notes: None.
*
*       File:  cm_hash.c
*
*/

#ifdef ANSI
PRIVATE S16 cmHashFuncDefault
(
CmHashListCp       *hashListCp,        /* hash list control point */
U8                 *key,               /* key string */
U16                keyLen,             /* length of key string */
U16                *idx                /* index to return */
) 
#else
PRIVATE S16 cmHashFuncDefault(hashListCp, key, keyLen, idx)
CmHashListCp       *hashListCp;        /* hash list control point */
U8                 *key;               /* key string */
U16                keyLen;             /* length of key string */
U16                *idx;               /* index to return */
#endif
{
   U32             sum;                /* sum of key string octets */

   TRC2(cmHashFuncDefault);

   /* add all bytes of the key */
   sum = 0;
   while (keyLen--)
      sum += (U32) (*key++);

   /* compute index by dividing the range into the sum */

   /* if nmbBins is a power of 2, use shift, else use division */
   if (hashListCp->binBitMask != CM_HASH_NOBITMASK)
      *idx = (U16) (sum & hashListCp->binBitMask);
   else
      *idx = (U16) (sum % hashListCp->nmbBins);

   RETVALUE(ROK);

} /* end of cmHashFuncDefault */

  
/*
*
*       Fun:   cmHashFuncMult24
*
*       Desc:  Computes the hash list index (bin number) for a specified
*              key of type CM_HASH_KEYTYPE_MULT24. 
*
*              Multiplies the given key (max k bits) with a constant
*              multiplier and extracts p bits of the result, from the 
*              bit position k-1 to bit position k-p, to get the hash
*              list index. p is such that 2^p is number of bins.
*
*              The constant multiplier is the floor of A * 2^k, for
*              some constant A.
*
*              This function uses a pre-computed constant multiplier
*              CM_HASH_MULTMETHOD_CNST24, which is computed for 
*              A = (sqrt(5) - 1)/2, and k = 24 bits.
*
*              This hashing method is explained in section 12.3.2 of
*              "Introduction to Algorithms" by Thomas H. Cormen et al.,
*              The MIT Press.
*
*       Ret:   ROK     - successful, *idx contains computed index 
*
*       Notes: None.
*
*       File:  cm_hash.c
*
*/

#ifdef ANSI
PRIVATE S16 cmHashFuncMult24
(
CmHashListCp       *hashListCp,        /* hash list control point */
U8                 *key,               /* key string */
U16                keyLen,             /* length of key string */
U16                *idx                /* index to return */
) 
#else
PRIVATE S16 cmHashFuncMult24(hashListCp, key, keyLen, idx)
CmHashListCp       *hashListCp;        /* hash list control point */
U8                 *key;               /* key string */
U16                keyLen;             /* length of key string */
U16                *idx;               /* index to return */
#endif
{
   U32             prod;               /* (constant multiplier * key) */
   U8              shift;              /* Bits to be shifted to get index */

   TRC2(cmHashFuncMult24);

   UNUSED(keyLen);

#if (ERRCLASS & ERRCLS_DEBUG)
   /* error check on parameters */
   if (hashListCp->binBitMask == CM_HASH_NOBITMASK)
      RETVALUE(RFAILED);
#endif

   prod = CM_HASH_MULT24_CONST * *((U32 *)key);

   shift = CM_HASH_MULT24_BITPOS - hashListCp->nmbBinBits;
   *idx = ((U16) (prod & (hashListCp->binBitMask << shift))) >> shift;

   RETVALUE(ROK);
} /* end of cmHashFuncMult24 */

  
/*
*
*       Fun:   cmHashFuncDirIdx
*
*       Desc:  Computes the hash list index (bin number) for a specified
*              key of type CM_HASH_KEYTYPE_DIRINDEX. 
*
*              The key is the hash table index.
*
*       Ret:   ROK     - successful, *idx contains computed index 
*
*       Notes: None.
*
*       File:  cm_hash.c
*
*/

#ifdef ANSI
PRIVATE S16 cmHashFuncDirIdx
(
CmHashListCp       *hashListCp,        /* hash list control point */
U8                 *key,               /* key string */
U16                keyLen,             /* length of key string */
U16                *idx                /* index to return */
) 
#else
PRIVATE S16 cmHashFuncDirIdx(hashListCp, key, keyLen, idx)
CmHashListCp       *hashListCp;        /* hash list control point */
U8                 *key;               /* key string */
U16                keyLen;             /* length of key string */
U16                *idx;               /* index to return */
#endif
{
   TRC2(cmHashFuncDirIdx);

   UNUSED(hashListCp);
   UNUSED(keyLen);

   *idx = *((U16 *) key);

   RETVALUE(ROK);
} /* end of cmHashFuncDirIdx */

  
/*
*
*       Fun:   cmHashMatchKey
*
*       Desc:  Compares two keys and determines if they match.
*
*       Ret:   ROK     - match successful
*              RFAILED - match failed (non-matching key values)
*
*       Notes: None.
*
*       File:  cm_hash.c
*
*/

#ifdef ANSI
PRIVATE S16 cmHashMatchKey
(
U8 *key1,                         /* first key string */
U16 keyLen1,                      /* length of first key string */
U8 *key2,                         /* second key string */
U16 keyLen2                       /* length of second key string */
) 
#else
PRIVATE S16 cmHashMatchKey(key1, keyLen1, key2, keyLen2)
U8 *key1;                         /* first key string */
U16 keyLen1;                      /* length of first key string */
U8 *key2;                         /* second key string */
U16 keyLen2;                      /* length of second key string */
#endif
{
   TRC2(cmHashMatchKey);

   /* compare key lengths */
   if (keyLen1 != keyLen2)
      RETVALUE(RFAILED);

   /* compare key strings */
   RETVALUE(cmMemcmp(key1, key2, (PTR) keyLen1));
} /* end of cmHashMatchKey */

  
/*
*
*       Fun:   cmListInsert
*
*       Desc:  Adds an entry into a doubly linked list
*
*       Ret:   ROK      - insertion successful
*
*       Notes: None
*
*       File:  cm_hash.c
*
*/

#ifdef ANSI
PRIVATE S16 cmListInsert
(
CmListEnt *oldEntry,                    /* add new entry after this entry */
CmListEnt *newEntry                     /* new entry to add */
) 
#else
PRIVATE S16 cmListInsert(oldEntry, newEntry) 
CmListEnt *oldEntry;                    /* add new entry after this entry */
CmListEnt *newEntry;                    /* new entry to add */
#endif
{
   TRC2(cmListInsert);

   newEntry->next         = oldEntry->next;
   newEntry->prev         = oldEntry;
   oldEntry->next         = newEntry;
   (newEntry->next)->prev = newEntry;

   RETVALUE(ROK);
} /* end of cmListInsert */

  
/*
*
*       Fun:   cmListDelete
*
*       Desc:  Deletes an entry from a doubly linked list
*

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩女优制服丝袜电影| 亚洲三级小视频| 日韩一区二区三区免费看| 欧美乱熟臀69xxxxxx| 91麻豆精品国产自产在线 | 综合久久久久久久| 亚洲欧美日韩在线| 亚洲女与黑人做爰| 亚洲午夜在线视频| 日韩有码一区二区三区| 麻豆视频一区二区| 精品一区二区在线观看| 成人网男人的天堂| 在线视频欧美区| 欧洲国产伦久久久久久久| 国产一区二区免费在线| 国产综合久久久久久久久久久久| 日韩一区精品视频| 免费日韩伦理电影| 国产大片一区二区| 国产成人啪免费观看软件 | 亚洲免费观看视频| 亚洲伦理在线免费看| 亚洲日本中文字幕区| 亚洲成人资源在线| 午夜私人影院久久久久| 另类小说欧美激情| 狠狠色丁香婷婷综合久久片| 国产一区二区三区免费播放| 成人午夜av电影| 欧美亚洲禁片免费| 6080yy午夜一二三区久久| 欧美一区二区三区播放老司机| 日韩视频中午一区| 欧美精品一区二区久久久| 国产色产综合色产在线视频 | 午夜私人影院久久久久| 无码av中文一区二区三区桃花岛| 久久精品国产免费看久久精品| 狠狠色综合播放一区二区| 另类的小说在线视频另类成人小视频在线 | 欧美色图在线观看| 日韩手机在线导航| 国产精品久久久久久久久久久免费看 | 丰满少妇在线播放bd日韩电影| av亚洲精华国产精华精| 色菇凉天天综合网| 欧美丝袜丝nylons| 欧美精品在线一区二区三区| 欧美一级高清片在线观看| 久久久久国产精品麻豆ai换脸 | 麻豆视频一区二区| av成人动漫在线观看| 欧洲精品在线观看| 久久亚洲捆绑美女| 亚洲欧美另类综合偷拍| 亚洲va欧美va人人爽午夜| 国产福利精品一区| 欧美三级三级三级| 国产日韩欧美电影| 国产精品成人免费在线| 一区二区三区.www| 青青草成人在线观看| 菠萝蜜视频在线观看一区| 欧美日韩国产免费| 亚洲欧洲精品一区二区三区| 三级不卡在线观看| 成人h动漫精品一区二| 3d成人动漫网站| 欧美激情一区在线| 奇米精品一区二区三区在线观看一| 久久电影网站中文字幕| 色屁屁一区二区| 久久久久久免费毛片精品| 亚洲综合图片区| 国产 欧美在线| 在线不卡一区二区| 亚洲欧美日韩中文字幕一区二区三区| 天天综合日日夜夜精品| 国产真实乱对白精彩久久| 在线视频中文字幕一区二区| 久久久精品天堂| 日韩高清不卡一区二区三区| 成人不卡免费av| 欧美不卡一区二区三区四区| 亚洲视频狠狠干| 狠狠色丁香久久婷婷综| 在线播放欧美女士性生活| 亚洲蜜桃精久久久久久久| 国产成人精品影院| 日韩一区二区三区av| 国产精品色婷婷久久58| 亚洲电影视频在线| www.亚洲色图| 国产清纯美女被跳蛋高潮一区二区久久w| 首页国产欧美日韩丝袜| 波多野结衣在线aⅴ中文字幕不卡 波多野结衣在线一区 | 在线视频一区二区免费| 欧美激情一区二区三区全黄| 精品午夜久久福利影院| 欧美怡红院视频| 亚洲欧美在线高清| 成人一区在线看| xvideos.蜜桃一区二区| 视频一区视频二区中文| 在线视频亚洲一区| 亚洲欧美一区二区三区孕妇| 成人黄色片在线观看| 欧美精品一区二区三区很污很色的| 偷拍自拍另类欧美| 99久精品国产| 精品国内片67194| 日本女人一区二区三区| 欧美猛男超大videosgay| 亚洲第一久久影院| 制服丝袜亚洲色图| 午夜激情久久久| 色久优优欧美色久优优| 亚洲欧洲综合另类| 国产乱子轮精品视频| 欧美一区二区黄色| 日韩av在线播放中文字幕| 欧美日韩aaa| 久久99久久99| 26uuu色噜噜精品一区二区| 国产真实乱对白精彩久久| 国产欧美日韩激情| 成人污污视频在线观看| 亚洲欧美综合网| 国产福利视频一区二区三区| 亚洲色图欧美激情| 久久在线免费观看| 国产成人精品免费网站| 欧美激情综合五月色丁香 | 精品裸体舞一区二区三区| 视频一区二区欧美| 91丨porny丨在线| 国产精品午夜在线| 成人av综合在线| 尤物在线观看一区| 欧美日韩aaa| 精品一区二区在线视频| 国产欧美一区二区精品婷婷| 色狠狠一区二区三区香蕉| 亚洲国产aⅴ成人精品无吗| 欧美成人a在线| 国产精品一区在线| 日韩伦理电影网| 在线观看日产精品| 日韩精品一卡二卡三卡四卡无卡| 欧美日韩不卡在线| 国产91精品久久久久久久网曝门 | 国产一区二区三区四区五区美女| 国产无人区一区二区三区| 波多野结衣的一区二区三区| 亚洲欧美日韩一区| 91精品综合久久久久久| 国产美女娇喘av呻吟久久 | 国产精品一区三区| 国产精品麻豆一区二区 | 一本大道久久a久久综合| 免费久久精品视频| 国产精品人人做人人爽人人添| 欧美性受xxxx| 亚洲一区二区视频在线观看| 欧美综合在线视频| 久久精品国产亚洲5555| 国产精品色在线观看| 欧美日本一道本在线视频| 精品一区二区三区影院在线午夜| 中文字幕在线观看不卡| 欧美美女喷水视频| 国产成人在线视频播放| 亚洲一区二区在线免费观看视频| 久久久www成人免费毛片麻豆| 色婷婷国产精品| 久久av中文字幕片| 亚洲欧洲另类国产综合| 日韩欧美一区在线| 成人在线综合网| 日本aⅴ亚洲精品中文乱码| 中文字幕在线观看不卡视频| 欧美蜜桃一区二区三区| 色婷婷av一区二区三区大白胸| 久久电影网站中文字幕| 最新国产成人在线观看| 日韩视频中午一区| 国产一二三精品| 亚洲一二三四在线| 精品国产伦一区二区三区观看体验| 国产专区综合网| 亚洲综合图片区| 亚洲欧洲无码一区二区三区| 国产视频一区在线观看 | 国产视频不卡一区| 欧美一区二区三区免费| 欧美色图在线观看| 成人手机电影网| 国产一区二区三区| 精品一区二区日韩|