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

Re: RFS: jabbin



On Thursday 24 August 2006 09:45, Andrew Donnellan wrote:
> I've found the relevant piece of code:
[SNIP]
> #elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )
>       asm("rdtsc" : "=A" (tick));
> #elif defined (__SUNPRO_CC) || defined( __sparc__ )
>       tick = gethrtime();
> #elif defined(__MACH__)
>       int fd=open("/dev/random",O_RDONLY);
>       read(fd,&tick,sizeof(tick));
>       closesocket(fd);
> #else
> #     error Need some way to seed the random number generator
> #endif
[SNIP]
>
> Does anyone know what the appropriate code for PowerPC would be?

The attached patch should fix the compilation on *all* non linux-x86 
archs, without breaking the supported archs.

please test it on other archs, i've tested only on linux-x86 and 
linux-ppc.


Regards
Francesco

-- 
:wq
--- /tmp/jabbin-2.0beta2a/voip/stun.cpp	2006-08-10 12:09:57.000000000 +0200
+++ jabbin-2.0beta2a/voip/stun.cpp	2006-08-25 00:58:44.000000000 +0200
@@ -669,17 +669,13 @@
       tick = hightick;
       tick <<= 32;
       tick |= lowtick;
-#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) )
-      asm("rdtsc" : "=A" (tick));
 #elif defined (__SUNPRO_CC) || defined( __sparc__ )	
       tick = gethrtime();
-#elif defined(__MACH__) 
+#elif defined( __MACH__ )|| defined( __GNUC__ ) 
       int fd=open("/dev/random",O_RDONLY);
       read(fd,&tick,sizeof(tick));
       closesocket(fd);
-#else
-#     error Need some way to seed the random number generator 
-#endif 
+#endif
       int seed = int(tick);
 #ifdef WIN32
       srand(seed);

Attachment: pgpH4KOREbNVw.pgp
Description: PGP signature


Reply to: