56 #if uword_bits != 32 && uword_bits != 64 57 #error "isaac only works for 32 or 64 bit words" 62 #define ind32(mm,x) (*(u32 *)((u8 *)(mm) + ((x) & ((ISAAC_SIZE-1)<<2)))) 63 #define rngstep32(mix,a,b,mm,m,m2,r,x,y) \ 66 a = (a^(mix)) + *(m2++); \ 67 *(m++) = y = ind32(mm,x) + a + b; \ 68 *(r++) = b = ind32(mm,y>>ISAAC_LOG2_SIZE) + x; \ 74 u32 a, b,
c, x,
y, *m, *mm, *m2, *r, *mend;
87 rngstep32 (a << 13, a, b, mm, m, m2, r, x, y);
88 rngstep32 (a >> 6, a, b, mm, m, m2, r, x, y);
89 rngstep32 (a << 2, a, b, mm, m, m2, r, x, y);
90 rngstep32 (a >> 16, a, b, mm, m, m2, r, x, y);
96 rngstep32 (a << 13, a, b, mm, m, m2, r, x, y);
97 rngstep32 (a >> 6, a, b, mm, m, m2, r, x, y);
98 rngstep32 (a << 2, a, b, mm, m, m2, r, x, y);
99 rngstep32 (a >> 16, a, b, mm, m, m2, r, x, y);
112 u32 a##n, b##n, c##n, x##n, y##n, * m##n, * mm##n, * m2##n, * r##n, * mend##n 121 mm##n = ctx[(n)].memory; \ 122 r##n = results + (n) * ISAAC_SIZE; \ 127 mend##n = m2##n = mm##n + ARRAY_LEN (ctx[(n)].memory) / 2; \ 138 rngstep32 (a0 << 13, a0, b0, mm0, m0, m20, r0, x0, y0);
139 rngstep32 (a1 << 13, a1, b1, mm1, m1, m21, r1, x1, y1);
140 rngstep32 (a0 >> 6, a0, b0, mm0, m0, m20, r0, x0, y0);
141 rngstep32 (a1 >> 6, a1, b1, mm1, m1, m21, r1, x1, y1);
142 rngstep32 (a0 << 2, a0, b0, mm0, m0, m20, r0, x0, y0);
143 rngstep32 (a1 << 2, a1, b1, mm1, m1, m21, r1, x1, y1);
144 rngstep32 (a0 >> 16, a0, b0, mm0, m0, m20, r0, x0, y0);
145 rngstep32 (a1 >> 16, a1, b1, mm1, m1, m21, r1, x1, y1);
152 rngstep32 (a0 << 13, a0, b0, mm0, m0, m20, r0, x0, y0);
153 rngstep32 (a1 << 13, a1, b1, mm1, m1, m21, r1, x1, y1);
154 rngstep32 (a0 >> 6, a0, b0, mm0, m0, m20, r0, x0, y0);
155 rngstep32 (a1 >> 6, a1, b1, mm1, m1, m21, r1, x1, y1);
156 rngstep32 (a0 << 2, a0, b0, mm0, m0, m20, r0, x0, y0);
157 rngstep32 (a1 << 2, a1, b1, mm1, m1, m21, r1, x1, y1);
158 rngstep32 (a0 >> 16, a0, b0, mm0, m0, m20, r0, x0, y0);
159 rngstep32 (a1 >> 16, a1, b1, mm1, m1, m21, r1, x1, y1);
170 #define mix32(a,b,c,d,e,f,g,h) \ 172 a^=b<<11; d+=a; b+=c; \ 173 b^=c>>2; e+=b; c+=d; \ 174 c^=d<<8; f+=c; d+=e; \ 175 d^=e>>16; g+=d; e+=f; \ 176 e^=f<<10; h+=e; f+=g; \ 177 f^=g>>4; a+=f; g+=h; \ 178 g^=h<<8; b+=g; h+=a; \ 179 h^=a>>9; c+=h; a+=b; \ 186 u32 a, b,
c, d, e, f, g, h, *m, *r;
188 ctx->
a = ctx->
b = ctx->
c = 0;
192 a = b = c = d = e = f = g = h = 0x9e3779b9;
194 for (i = 0; i < 4; ++
i)
195 mix32 (a, b, c, d, e, f, g, h);
208 mix32 (a, b, c, d, e, f, g, h);
230 mix32 (a, b, c, d, e, f, g, h);
245 #define ind64(mm,x) (*(u64 *)((u8 *)(mm) + ((x) & ((ISAAC_SIZE-1)<<3)))) 246 #define rngstep64(mix,a,b,mm,m,m2,r,x,y) \ 249 a = (mix) + *(m2++); \ 250 *(m++) = y = ind64(mm,x) + a + b; \ 251 *(r++) = b = ind64(mm,y>>ISAAC_LOG2_SIZE) + x; \ 257 u64 a, b,
c, x,
y, *m, *mm, *m2, *r, *mend;
270 rngstep64 (~(a ^ (a << 21)), a, b, mm, m, m2, r, x, y);
271 rngstep64 (a ^ (a >> 5), a, b, mm, m, m2, r, x, y);
272 rngstep64 (a ^ (a << 12), a, b, mm, m, m2, r, x, y);
273 rngstep64 (a ^ (a >> 33), a, b, mm, m, m2, r, x, y);
279 rngstep64 (~(a ^ (a << 21)), a, b, mm, m, m2, r, x, y);
280 rngstep64 (a ^ (a >> 5), a, b, mm, m, m2, r, x, y);
281 rngstep64 (a ^ (a << 12), a, b, mm, m, m2, r, x, y);
282 rngstep64 (a ^ (a >> 33), a, b, mm, m, m2, r, x, y);
295 u64 a##n, b##n, c##n, x##n, y##n, * m##n, * mm##n, * m2##n, * r##n, * mend##n 304 mm##n = ctx[(n)].memory; \ 305 r##n = results + (n) * ISAAC_SIZE; \ 310 mend##n = m2##n = mm##n + ARRAY_LEN (ctx[(n)].memory) / 2; \ 323 rngstep64 (~(a0 ^ (a0 << 21)), a0, b0, mm0, m0, m20, r0, x0, y0);
324 rngstep64 (~(a1 ^ (a1 << 21)), a1, b1, mm1, m1, m21, r1, x1, y1);
325 rngstep64 (a0 ^ (a0 >> 5), a0, b0, mm0, m0, m20, r0, x0, y0);
326 rngstep64 (a1 ^ (a1 >> 5), a1, b1, mm1, m1, m21, r1, x1, y1);
327 rngstep64 (a0 ^ (a0 << 12), a0, b0, mm0, m0, m20, r0, x0, y0);
328 rngstep64 (a1 ^ (a1 << 12), a1, b1, mm1, m1, m21, r1, x1, y1);
329 rngstep64 (a0 ^ (a0 >> 33), a0, b0, mm0, m0, m20, r0, x0, y0);
330 rngstep64 (a1 ^ (a1 >> 33), a1, b1, mm1, m1, m21, r1, x1, y1);
337 rngstep64 (~(a0 ^ (a0 << 21)), a0, b0, mm0, m0, m20, r0, x0, y0);
338 rngstep64 (~(a1 ^ (a1 << 21)), a1, b1, mm1, m1, m21, r1, x1, y1);
339 rngstep64 (a0 ^ (a0 >> 5), a0, b0, mm0, m0, m20, r0, x0, y0);
340 rngstep64 (a1 ^ (a1 >> 5), a1, b1, mm1, m1, m21, r1, x1, y1);
341 rngstep64 (a0 ^ (a0 << 12), a0, b0, mm0, m0, m20, r0, x0, y0);
342 rngstep64 (a1 ^ (a1 << 12), a1, b1, mm1, m1, m21, r1, x1, y1);
343 rngstep64 (a0 ^ (a0 >> 33), a0, b0, mm0, m0, m20, r0, x0, y0);
344 rngstep64 (a1 ^ (a1 >> 33), a1, b1, mm1, m1, m21, r1, x1, y1);
355 #define mix64(a,b,c,d,e,f,g,h) \ 357 a-=e; f^=h>>9; h+=a; \ 358 b-=f; g^=a<<9; a+=b; \ 359 c-=g; h^=b>>23; b+=c; \ 360 d-=h; a^=c<<15; c+=d; \ 361 e-=a; b^=d>>14; d+=e; \ 362 f-=b; c^=e<<20; e+=f; \ 363 g-=c; d^=f>>17; f+=g; \ 364 h-=d; e^=g<<14; g+=h; \ 371 u64 a, b,
c, d, e, f, g, h, *m, *r;
373 ctx->
a = ctx->
b = ctx->
c = 0;
377 a = b = c = d = e = f = g = h = 0x9e3779b97f4a7c13LL;
379 for (i = 0; i < 4; ++
i)
380 mix64 (a, b, c, d, e, f, g, h);
392 mix64 (a, b, c, d, e, f, g, h);
414 mix64 (a, b, c, d, e, f, g, h);
sll srl srl sll sra u16x4 i
void isaac_init(isaac_t *ctx, uword *results)
add_epi add_epi sub_epi sub_epi adds_epu subs_epu i16x8 y
void isaac2(isaac_t *ctx, uword *results)
void isaac(isaac_t *ctx, uword *results)