Changeset 156 for trunk/src


Ignore:
Timestamp:
Jan 13, 2008, 7:25:06 PM (17 years ago)
Author:
katerina
Message:

Put result vector of rng in skey struct, fix HP-UX compile error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_utils.c

    r149 r156  
    941941UINT32 taus_get ()
    942942{
    943   UINT32   taus_svec[6];
     943#define TAUS_SAMPLE 12
     944
     945  UINT32   taus_svec[TAUS_SAMPLE];
    944946  UINT32   retval;
    945947  UINT32 * res;
    946   static   UINT32   res_vec[6];
     948  UINT32 * res_vec = &(skey->res_vec[0]);
    947949  static   int      res_num = 0;
    948950  register int i;
     
    962964
    963965  SH_MUTEX_LOCK_UNSAFE(mutex_skey);
    964   taus_svec[0] = taus_get_long (&(skey->rng0[0]));
    965   taus_svec[1] = taus_get_long (&(skey->rng1[0]));
    966   taus_svec[2] = taus_get_long (&(skey->rng2[0]));
    967   taus_svec[3] = taus_get_long (&(skey->rng0[0]));
    968   taus_svec[4] = taus_get_long (&(skey->rng1[0]));
    969   taus_svec[5] = taus_get_long (&(skey->rng2[0]));
     966  for (i = 0; i < (TAUS_SAMPLE/3); ++i)
     967    {
     968      taus_svec[i*3]   = taus_get_long (&(skey->rng0[0]));
     969      taus_svec[i*3+1] = taus_get_long (&(skey->rng1[0]));
     970      taus_svec[i*3+2] = taus_get_long (&(skey->rng2[0]));
     971    }
    970972  SH_MUTEX_UNLOCK_UNSAFE(mutex_skey);
    971973
    972974  res     = sh_tiger_hash_uint32 ( (char *) &taus_svec[0],
    973975                                   TIGER_DATA,
    974                                    (unsigned long)(6 * sizeof(UINT32)),
     976                                   (unsigned long)(TAUS_SAMPLE * sizeof(UINT32)),
    975977                                   kbuf, KEY_BYT/sizeof(UINT32));
    976978
     
    980982      res_vec[i] = res[i];
    981983    }
    982   retval  = taus_svec[0];
     984  retval  = res[0];
    983985  res_num = 1;
    984986  SH_MUTEX_UNLOCK_UNSAFE(mutex_skey);
    985987
    986   taus_svec[0] = 0; taus_svec[1] = 0; taus_svec[2] = 0;
    987   taus_svec[3] = 0; taus_svec[4] = 0; taus_svec[5] = 0;
     988  memset(taus_svec, '\0', TAUS_SAMPLE * sizeof(UINT32));
    988989
    989990  return retval;
Note: See TracChangeset for help on using the changeset viewer.