Re: Extremely poor performance crunching random numbers under PIV-FC5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 19, 2006 at 04:16:40PM +0200, BankHacker wrote:
> Jakub, I have tried to do what you propose but the following code is
> throwing an error in execution time:
> 
> ### prueba-3.c ##################################################
> 	#include <stdio.h>
> 	#include <stdlib.h>
> 	#include <fcntl.h>
> 
> 	int bucle_random_r() {
> 		int nRandom;
> 		struct random_data *randomdataState;

This is an uninitialized pointer:

> 		static int buf[32];
> 		time_t seconds;
> 		extern void *memset (void *__s, int __c, size_t __n) __THROW;

Don't do this ^^^, string.h provides prototype.
> 
> 		memset(randomdataState, 0, sizeof(*randomdataState));

And you dereference the uninitialized pointer here ^^^.

Either have
struct random_data randomdataState;
and replace current uses of *randomdataState with randomdataState and
currnet uses of randomdataState with &randomdataState, or initialize
the pointer to an address of some struct random_data.

	Jakub


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux