Hmm, I guess I need a sys::Math::getRandom() function that uses a "good" random number generator on the given platform. I'll make a note of this and tuck it away for future implementation. Reid. Chris Lattner wrote:> On Tue, 28 Sep 2004, Paolo Invernizzi wrote: > > >>The next major problem is that VC has only >> >>int rand(void) >>void srand( int seed ) >> >>So I donno how to compile the >>ExecutionEngine/Interpreter/ExternalFunctions.cpp that refers to the >>drand48 srand48 lrand48 etc series... >>For now I hacked them, like >> >>double drand48(void) { return (float) rand() / (float) RAND_MAX > > > For these, just ifdef them out. If the platform doesn't support drand48, > there is no reason for the interpreter to do so either... > > -Chris >
OIC .. I was wondering what the heck the Interpreter was doing with random number generation. "hmm, should we execute this function or not? .. let's toss a coin" ;> Reid. Chris Lattner wrote:> On Wed, 29 Sep 2004, Reid Spencer wrote: > > >>>On Tue, 28 Sep 2004, Paolo Invernizzi wrote: >>> >>>>The next major problem is that VC has only >>>> >>>>int rand(void) >>>>void srand( int seed ) >>>> >>>>So I donno how to compile the >>>>ExecutionEngine/Interpreter/ExternalFunctions.cpp that refers to the >>>>drand48 srand48 lrand48 etc series... > > >>I guess I need a sys::Math::getRandom() function that uses a "good" random >>number generator on the given platform. I'll make a note of this and tuck it >>away for future implementation. > > > No, LLVM has no need for random numbers. The methods in > Interpreter/ExternalFunctions.cpp are just wrappers around system > functions of the same name (to avoid having an FFI). In reality, these > things can just be removed without too much lossage, but Brian would be > the person to ok that. > > -Chris >
On Wed, 29 Sep 2004, Reid Spencer wrote:> > On Tue, 28 Sep 2004, Paolo Invernizzi wrote: > >>The next major problem is that VC has only > >> > >>int rand(void) > >>void srand( int seed ) > >> > >>So I donno how to compile the > >>ExecutionEngine/Interpreter/ExternalFunctions.cpp that refers to the > >>drand48 srand48 lrand48 etc series...> I guess I need a sys::Math::getRandom() function that uses a "good" random > number generator on the given platform. I'll make a note of this and tuck it > away for future implementation.No, LLVM has no need for random numbers. The methods in Interpreter/ExternalFunctions.cpp are just wrappers around system functions of the same name (to avoid having an FFI). In reality, these things can just be removed without too much lossage, but Brian would be the person to ok that. -Chris -- http://llvm.org/ http://nondot.org/sabre/