@@ -130,37 +130,39 @@ impl IsaacRng {
130
130
macro_rules! ind ( ( $x: expr) => {
131
131
self . mem[ ( ( $x >> 2 ) as uint & ( ( RAND_SIZE - 1 ) as uint) ) ]
132
132
} ) ;
133
- macro_rules! rngstepp(
134
- ( $j: expr, $shift: expr) => { {
135
- let base = $j;
136
- let mix = a << $shift as uint;
137
-
138
- let x = self . mem[ base + mr_offset] ;
139
- a = ( a ^ mix) + self . mem[ base + m2_offset] ;
140
- let y = ind!( x) + a + b;
141
- self . mem[ base + mr_offset] = y;
142
-
143
- b = ind!( y >> RAND_SIZE_LEN as uint) + x;
144
- self . rsl[ base + mr_offset] = b;
145
- } }
146
- ) ;
147
- macro_rules! rngstepn(
148
- ( $j: expr, $shift: expr) => { {
149
- let base = $j;
150
- let mix = a >> $shift as uint;
151
-
152
- let x = self . mem[ base + mr_offset] ;
153
- a = ( a ^ mix) + self . mem[ base + m2_offset] ;
154
- let y = ind!( x) + a + b;
155
- self . mem[ base + mr_offset] = y;
156
-
157
- b = ind!( y >> RAND_SIZE_LEN as uint) + x;
158
- self . rsl[ base + mr_offset] = b;
159
- } }
160
- ) ;
161
133
162
134
let r = [ ( 0 , MIDPOINT ) , ( MIDPOINT , 0 ) ] ;
163
135
for & ( mr_offset, m2_offset) in r. iter ( ) {
136
+
137
+ macro_rules! rngstepp(
138
+ ( $j: expr, $shift: expr) => { {
139
+ let base = $j;
140
+ let mix = a << $shift as uint;
141
+
142
+ let x = self . mem[ base + mr_offset] ;
143
+ a = ( a ^ mix) + self . mem[ base + m2_offset] ;
144
+ let y = ind!( x) + a + b;
145
+ self . mem[ base + mr_offset] = y;
146
+
147
+ b = ind!( y >> RAND_SIZE_LEN as uint) + x;
148
+ self . rsl[ base + mr_offset] = b;
149
+ } }
150
+ ) ;
151
+ macro_rules! rngstepn(
152
+ ( $j: expr, $shift: expr) => { {
153
+ let base = $j;
154
+ let mix = a >> $shift as uint;
155
+
156
+ let x = self . mem[ base + mr_offset] ;
157
+ a = ( a ^ mix) + self . mem[ base + m2_offset] ;
158
+ let y = ind!( x) + a + b;
159
+ self . mem[ base + mr_offset] = y;
160
+
161
+ b = ind!( y >> RAND_SIZE_LEN as uint) + x;
162
+ self . rsl[ base + mr_offset] = b;
163
+ } }
164
+ ) ;
165
+
164
166
for i in range_step ( 0 u, MIDPOINT , 4 ) {
165
167
rngstepp ! ( i + 0 , 13 ) ;
166
168
rngstepn ! ( i + 1 , 6 ) ;
@@ -349,43 +351,44 @@ impl Isaac64Rng {
349
351
* self . mem. unsafe_ref( ( $x as uint >> 3 ) & ( RAND_SIZE_64 - 1 ) )
350
352
}
351
353
) ;
352
- macro_rules! rngstepp(
353
- ( $j: expr, $shift: expr) => { {
354
- let base = base + $j;
355
- let mix = a ^ ( a << $shift as uint) ;
356
- let mix = if $j == 0 { !mix} else { mix} ;
357
-
358
- unsafe {
359
- let x = * self . mem. unsafe_ref( base + mr_offset) ;
360
- a = mix + * self . mem. unsafe_ref( base + m2_offset) ;
361
- let y = ind!( x) + a + b;
362
- self . mem. unsafe_set( base + mr_offset, y) ;
363
-
364
- b = ind!( y >> RAND_SIZE_64_LEN ) + x;
365
- self . rsl. unsafe_set( base + mr_offset, b) ;
366
- }
367
- } }
368
- ) ;
369
- macro_rules! rngstepn(
370
- ( $j: expr, $shift: expr) => { {
371
- let base = base + $j;
372
- let mix = a ^ ( a >> $shift as uint) ;
373
- let mix = if $j == 0 { !mix} else { mix} ;
374
-
375
- unsafe {
376
- let x = * self . mem. unsafe_ref( base + mr_offset) ;
377
- a = mix + * self . mem. unsafe_ref( base + m2_offset) ;
378
- let y = ind!( x) + a + b;
379
- self . mem. unsafe_set( base + mr_offset, y) ;
380
-
381
- b = ind!( y >> RAND_SIZE_64_LEN ) + x;
382
- self . rsl. unsafe_set( base + mr_offset, b) ;
383
- }
384
- } }
385
- ) ;
386
354
387
355
for & ( mr_offset, m2_offset) in MP_VEC . iter ( ) {
388
356
for base in range ( 0 , MIDPOINT / 4 ) . map ( |i| i * 4 ) {
357
+
358
+ macro_rules! rngstepp(
359
+ ( $j: expr, $shift: expr) => { {
360
+ let base = base + $j;
361
+ let mix = a ^ ( a << $shift as uint) ;
362
+ let mix = if $j == 0 { !mix} else { mix} ;
363
+
364
+ unsafe {
365
+ let x = * self . mem. unsafe_ref( base + mr_offset) ;
366
+ a = mix + * self . mem. unsafe_ref( base + m2_offset) ;
367
+ let y = ind!( x) + a + b;
368
+ self . mem. unsafe_set( base + mr_offset, y) ;
369
+
370
+ b = ind!( y >> RAND_SIZE_64_LEN ) + x;
371
+ self . rsl. unsafe_set( base + mr_offset, b) ;
372
+ }
373
+ } }
374
+ ) ;
375
+ macro_rules! rngstepn(
376
+ ( $j: expr, $shift: expr) => { {
377
+ let base = base + $j;
378
+ let mix = a ^ ( a >> $shift as uint) ;
379
+ let mix = if $j == 0 { !mix} else { mix} ;
380
+
381
+ unsafe {
382
+ let x = * self . mem. unsafe_ref( base + mr_offset) ;
383
+ a = mix + * self . mem. unsafe_ref( base + m2_offset) ;
384
+ let y = ind!( x) + a + b;
385
+ self . mem. unsafe_set( base + mr_offset, y) ;
386
+
387
+ b = ind!( y >> RAND_SIZE_64_LEN ) + x;
388
+ self . rsl. unsafe_set( base + mr_offset, b) ;
389
+ }
390
+ } }
391
+ ) ;
389
392
rngstepp ! ( 0 , 21 ) ;
390
393
rngstepn ! ( 1 , 5 ) ;
391
394
rngstepp ! ( 2 , 12 ) ;
0 commit comments