46#if ((defined SSE)||(defined SSE2))
51}
vec_t __attribute__ ((aligned (16)));
58static int init=0,pr,prm,ir,jr,is,is_old,next[96];
65} x __attribute__ ((aligned (16)));
68 __asm__ __volatile__ ("movaps %2, %%xmm4 \n\t" \
69 "movaps %%xmm2, %%xmm3 \n\t" \
70 "subps %0, %%xmm4 \n\t" \
71 "movaps %%xmm1, %%xmm5 \n\t" \
72 "cmpps $0x6, %%xmm4, %%xmm2 \n\t" \
73 "andps %%xmm2, %%xmm5 \n\t" \
74 "subps %%xmm3, %%xmm4 \n\t" \
75 "andps %%xmm0, %%xmm2 \n\t" \
76 "addps %%xmm4, %%xmm5 \n\t" \
77 "movaps %%xmm5, %0 \n\t" \
78 "movaps %3, %%xmm6 \n\t" \
79 "movaps %%xmm2, %%xmm3 \n\t" \
80 "subps %1, %%xmm6 \n\t" \
81 "movaps %%xmm1, %%xmm7 \n\t" \
82 "cmpps $0x6, %%xmm6, %%xmm2 \n\t" \
83 "andps %%xmm2, %%xmm7 \n\t" \
84 "subps %%xmm3, %%xmm6 \n\t" \
85 "andps %%xmm0, %%xmm2 \n\t" \
86 "addps %%xmm6, %%xmm7 \n\t" \
96static void error(
int no)
101 printf(
"Error in subroutine rlxd_init\n");
102 printf(
"Bad choice of luxury level (should be 1 or 2)\n");
105 printf(
"Error in subroutine rlxd_init\n");
106 printf(
"Bad choice of seed (should be between 1 and 2^31-1)\n");
109 printf(
"Error in rlxd_get\n");
110 printf(
"Undefined state (ranlxd is not initialized\n");
113 printf(
"Error in rlxd_reset\n");
114 printf(
"Unexpected input data\n");
117 printf(
"Program aborted\n");
133 __asm__ __volatile__ (
"movaps %0, %%xmm0 \n\t"
134 "movaps %1, %%xmm1 \n\t"
153 __asm__ __volatile__ (
"movaps %%xmm2, %0"
169static void define_constants()
179 b=(float)(ldexp(1.0,-24));
197 int ibit,jbit,xbit[31];
217 if ((seed<=0)||(i!=0))
234 xbit[ibit]=(xbit[ibit]+xbit[jbit])%2;
242 x.num[4*k+i]=(float)(ldexp((
double)(
ix),-24));
272 r[k]=(double)(x.num[is+4])+(double)(one_bit.c1*x.num[is]);
291 base=(float)(ldexp(1.0,24));
295 state[k+1]=(
int)(base*x.num[k]);
297 state[97]=(int)(base*carry.
c1);
298 state[98]=(int)(base*carry.
c2);
299 state[99]=(int)(base*carry.
c3);
300 state[100]=(int)(base*carry.
c4);
320 if ((state[k+1]<0)||(state[k+1]>=167777216))
323 x.num[k]=(float)(ldexp((
double)(state[k+1]),-24));
326 if (((state[97]!=0)&&(state[97]!=1))||
327 ((state[98]!=0)&&(state[98]!=1))||
328 ((state[99]!=0)&&(state[99]!=1))||
329 ((state[100]!=0)&&(state[100]!=1)))
332 carry.
c1=(float)(ldexp((
double)(state[97]),-24));
333 carry.
c2=(float)(ldexp((
double)(state[98]),-24));
334 carry.
c3=(float)(ldexp((
double)(state[99]),-24));
335 carry.
c4=(float)(ldexp((
double)(state[100]),-24));
345 if (((pr!=202)&&(pr!=397))||
346 (ir<0)||(ir>11)||(jr<0)||(jr>11)||(jr!=((ir+7)%12))||
353#define BASE 0x1000000
366static int init=0,pr,prm,ir,jr,is,is_old,next[96];
367static double one_bit;
377 d=(*pj).c1.c1-(*pi).c1.c1-carry.c1; \
378 (*pi).c2.c1+=(d<0); \
380 (*pi).c1.c1=d&MASK; \
381 d=(*pj).c1.c2-(*pi).c1.c2-carry.c2; \
382 (*pi).c2.c2+=(d<0); \
384 (*pi).c1.c2=d&MASK; \
385 d=(*pj).c1.c3-(*pi).c1.c3-carry.c3; \
386 (*pi).c2.c3+=(d<0); \
388 (*pi).c1.c3=d&MASK; \
389 d=(*pj).c1.c4-(*pi).c1.c4-carry.c4; \
390 (*pi).c2.c4+=(d<0); \
392 (*pi).c1.c4=d&MASK; \
393 d=(*pj).c2.c1-(*pi).c2.c1; \
396 (*pi).c2.c1=d&MASK; \
397 d=(*pj).c2.c2-(*pi).c2.c2; \
400 (*pi).c2.c2=d&MASK; \
401 d=(*pj).c2.c3-(*pi).c2.c3; \
404 (*pi).c2.c3=d&MASK; \
405 d=(*pj).c2.c4-(*pi).c2.c4; \
411static void error(
int no)
416 printf(
"Error in rlxd_init\n");
417 printf(
"Arithmetic on this machine is not suitable for ranlxd\n");
420 printf(
"Error in subroutine rlxd_init\n");
421 printf(
"Bad choice of luxury level (should be 1 or 2)\n");
424 printf(
"Error in subroutine rlxd_init\n");
425 printf(
"Bad choice of seed (should be between 1 and 2^31-1)\n");
428 printf(
"Error in rlxd_get\n");
429 printf(
"Undefined state (ranlxd is not initialized)\n");
432 printf(
"Error in rlxd_reset\n");
433 printf(
"Arithmetic on this machine is not suitable for ranlxd\n");
436 printf(
"Error in rlxd_reset\n");
437 printf(
"Unexpected input data\n");
440 printf(
"Program aborted\n");
478static void define_constants()
482 one_bit=ldexp(1.0,-24);
496 int ibit,jbit,xbit[31];
499 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
520 if ((seed<=0)||(i!=0))
537 xbit[ibit]=(xbit[ibit]+xbit[jbit])%2;
575 r[k]=one_bit*((double)(x.num[is+4])+one_bit*(double)(x.num[is]));
614 if ((INT_MAX<2147483647)||(FLT_RADIX!=2)||(FLT_MANT_DIG<24)||
625 if ((state[k+1]<0)||(state[k+1]>=167777216))
631 if (((state[97]!=0)&&(state[97]!=1))||
632 ((state[98]!=0)&&(state[98]!=1))||
633 ((state[99]!=0)&&(state[99]!=1))||
634 ((state[100]!=0)&&(state[100]!=1)))
650 if (((pr!=202)&&(pr!=397))||
651 (ir<0)||(ir>11)||(jr<0)||(jr>11)||(jr!=((ir+7)%12))||
void rlxd_get(int state[])
void rlxd_reset(int state[])
void rlxd_init(int level, int seed)
void ranlxd(double r[], int n)
double precision pisqo6 one