[Bug 331043] Improve hash performance using _rotr intrinsic, r=brendan,nelson

This commit is contained in:
nelson%bolyard.com 2008-01-27 00:43:57 +00:00
Родитель f3b8c60285
Коммит 2efb83f575
2 изменённых файлов: 9 добавлений и 5 удалений

Просмотреть файл

@ -35,7 +35,7 @@
* ***** END LICENSE BLOCK ***** */
#ifdef DEBUG
static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.9 $ $Date: 2005-01-20 02:25:45 $";
static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.10 $ $Date: 2008-01-27 00:43:52 $";
#endif /* DEBUG */
/*
@ -52,6 +52,8 @@ static const char CVS_ID[] = "@(#) $RCSfile: hash.c,v $ $Revision: 1.9 $ $Date:
#include "base.h"
#endif /* BASE_H */
#include "prbit.h"
/*
* nssHash
*
@ -101,7 +103,7 @@ nss_item_hash
NSSItem *it = (NSSItem *)key;
h = 0;
for (i=0; i<it->size; i++)
h = (h >> 28) ^ (h << 4) ^ ((unsigned char *)it->data)[i];
h = PR_ROTATE_RIGHT32(h, 28) ^ ((unsigned char *)it->data)[i];
return h;
}

Просмотреть файл

@ -35,7 +35,7 @@
* ***** END LICENSE BLOCK ***** */
#ifdef DEBUG
static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.30 $ $Date: 2007-11-16 05:29:27 $";
static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.31 $ $Date: 2008-01-27 00:43:57 $";
#endif /* DEBUG */
#ifndef PKIM_H
@ -60,6 +60,8 @@ static const char CVS_ID[] = "@(#) $RCSfile: pkistore.c,v $ $Revision: 1.30 $ $D
#include "cert.h"
#include "prbit.h"
/*
* Certificate Store
*
@ -719,9 +721,9 @@ nss_certificate_hash (
NSSCertificate *c = (NSSCertificate *)key;
h = 0;
for (i=0; i<c->issuer.size; i++)
h = (h >> 28) ^ (h << 4) ^ ((unsigned char *)c->issuer.data)[i];
h = PR_ROTATE_RIGHT32(h, 28) ^ ((unsigned char *)c->issuer.data)[i];
for (i=0; i<c->serial.size; i++)
h = (h >> 28) ^ (h << 4) ^ ((unsigned char *)c->serial.data)[i];
h = PR_ROTATE_RIGHT32(h, 28) ^ ((unsigned char *)c->serial.data)[i];
return h;
}