Changeset 217
- Timestamp:
- 3/11/2008 4:31:27 AM (5 years ago)
- File:
-
- 1 edited
-
branches/eraser6/DefaultPlugins/ISAAC.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/DefaultPlugins/ISAAC.cs
r206 r217 31 31 { 32 32 //Generate 256 ints. 33 isaac.Isaac(); 33 if (isaac.count == 0) 34 isaac.Isaac(); 34 35 35 36 //Copy the data. 36 37 fixed (int* src = isaac.rsl) 37 fixed (byte* dest = buffer)38 fixed (byte* dest = &buffer[bytesGenerated]) 38 39 { 39 byte* bSrc = (byte*)src; 40 int bytesToCopy = Math.Min(Rand.ISAAC.SIZE, buffer.Length), 41 randArraySize = isaac.rsl.Length * sizeof(int); 40 //Advance to the end of the array of unused randomness. 41 //byte* bSrc = (byte*)src; 42 byte* pSrc = (byte*)(src + isaac.count); 43 byte* pDest = dest; 42 44 43 for (int i = 0; i < randArraySize && i < bytesToCopy; ++i) 44 dest[i] = bSrc[i]; 45 //Copy four bytes at a time, moving the source pointer backwards, 46 //and the destination pointer forwards. 47 int bytesToCopy = Math.Min(isaac.count * sizeof(int), 48 buffer.Length - bytesGenerated); 49 while (bytesToCopy >= 4) 50 { 51 pSrc -= sizeof(int); 52 *(int*)pDest = *(int*)pSrc; 53 pDest += sizeof(int); 54 55 bytesToCopy -= sizeof(int); 56 --isaac.count; 57 } 58 59 //Copy the remaining bytes over. 60 if (bytesToCopy != 0) 61 { 62 while (bytesToCopy-- != 0) 63 *pDest++ = *pSrc--; 64 --isaac.count; 65 } 45 66 } 46 67 }
Note: See TracChangeset
for help on using the changeset viewer.
