This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 6th, 2012  |  syntax: None  |  size: 1.46 KB  |  views: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     override void putArray(const(void)[] data) @trusted //nothrow //pure
  2.     {
  3.         bits += data.length << 3;
  4.         size_t remaining = blockLength - offset;
  5.  
  6.         auto bw = cast(ubyte[])w;
  7.  
  8.         if (data.length >= remaining)
  9.         {
  10.             //memcpy(&(cast(ubyte[])w)[offset], data.ptr, remaining);
  11.             bw[offset .. offset + remaining] = cast(const(ubyte)[])data[0 .. remaining];
  12.             transform();
  13.             data = data[remaining .. $];
  14.            
  15.             if (data.length >= blockLength)
  16.             {
  17.                 size_t blockCount = data.length / blockLength;
  18.                 auto wd = (cast(const(Word)[])data)[0 .. blockCount * blockSize];
  19.                 //std.stdio.writeln(wd.length);
  20.  
  21.                 foreach (i; 0 .. blockCount)
  22.                 {
  23.                     //memcpy(&w, &data[i * blockLength], blockLength);
  24.                     //auto offset = i * blockSize;
  25.                     w[0 .. blockSize] = wd[0 .. blockSize];
  26.                     wd = wd[blockSize .. $];
  27.                     transform();
  28.                 }
  29.                
  30.                 data = data[blockCount * blockLength .. $];
  31.             }
  32.            
  33.             offset = 0;
  34.         }
  35.        
  36.         if (data.length)
  37.         {
  38.             //memcpy(&(cast(ubyte[])w)[offset], data.ptr, data.length);
  39.             bw[offset .. offset + data.length] = cast(const(ubyte)[])data;
  40.             offset += data.length;
  41.         }
  42.     }
clone this paste RAW Paste Data