Branch: Tag:

1999-09-13

1999-09-13 22:19:15 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

small optimization

Rev: lib/modules/Crypto/randomness.pmod:1.12

1: - /* $Id: randomness.pmod,v 1.11 1999/08/25 17:32:54 grubba Exp $ + /* $Id: randomness.pmod,v 1.12 1999/09/13 22:19:15 hubbe Exp $    */      //! module Crypto
82:    //! Returns a string of length len with pseudo random values.    string read(int len)    { + #if 1 // 30% optimization /Hubbe +  string ret=""; +  if(len>=16384) +  { +  array x=allocate(16384,random); +  for(int e=0;e<(len/16384);e++) ret+=(string)x(256); +  } +  ret+=(string)allocate(len % 16384, random)(256); +  return ret; + #else    if (len > 16384) return read(len/2)+read(len-len/2);    return (string)allocate(len, random)(256); -  + #endif    }   }