pike.git / src / stuff.c

version» Context lines:

pike.git/src/stuff.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information.   */      #include "global.h"   #include "stuff.h"   #include "bitvector.h" + #include "pike_cpulib.h"      /* Used by is8bitalnum in pike_macros.h. */   PMOD_EXPORT const char Pike_is8bitalnum_vector[] =    "0000000000000000"    "0000000000000000"    "0000000000000000"    "1111111111000000"    "0111111111111111"    "1111111111100001"    "0111111111111111"
pike.git/src/stuff.c:120:   #define RNDBUF 250   #define RNDSTEP 7   #define RNDJUMP 103      static unsigned INT32 rndbuf[ RNDBUF ];   static unsigned int rnd_index;      #if HAS___BUILTIN_IA32_RDRAND32_STEP   static int use_rdrnd;   static unsigned long long rnd_index64; - #endif +    #define bit_RDRND_2 (1<<30) -  - #if SIZEOF_CHAR_P == 4 - #define __cpuid(level, a, b, c, d) \ -  __asm__ ("pushl %%ebx \n\t" \ -  "cpuid \n\t" \ -  "movl %%ebx, %1 \n\t" \ -  "popl %%ebx \n\t" \ -  : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ -  : "a" (level) \ -  : "cc") - #else - #define __cpuid(level, a, b, c, d) \ -  __asm__ ("push %%rbx \n\t" \ -  "cpuid \n\t" \ -  "movl %%ebx, %1 \n\t" \ -  "pop %%rbx \n\t" \ -  : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \ -  : "a" (level) \ -  : "cc") +    #endif      PMOD_EXPORT void my_srand(INT32 seed)   {   #if HAS___BUILTIN_IA32_RDRAND32_STEP    unsigned int ignore, cpuid_ecx;    if( !use_rdrnd )    { -  __cpuid( 0x1, ignore, ignore, cpuid_ecx, ignore ); -  if( cpuid_ecx & bit_RDRND_2 ) +  INT32 cpuid[4]; +  x86_get_cpuid (1, cpuid); +  if( cpuid[2] & bit_RDRND_2 )    use_rdrnd = 1;    }    /* We still do the initialization here, since rdrnd might stop    working if the hardware random unit in the CPU fails (according    to intel documentation).          This is likely to be rather rare. But the cost is not exactly    high.