Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override void putArray(const(void)[] data) @trusted //nothrow //pure
- {
- bits += data.length << 3;
- size_t remaining = blockLength - offset;
- auto bw = cast(ubyte[])w;
- if (data.length >= remaining)
- {
- //memcpy(&(cast(ubyte[])w)[offset], data.ptr, remaining);
- bw[offset .. offset + remaining] = cast(const(ubyte)[])data[0 .. remaining];
- transform();
- data = data[remaining .. $];
- if (data.length >= blockLength)
- {
- size_t blockCount = data.length / blockLength;
- auto wd = (cast(const(Word)[])data)[0 .. blockCount * blockSize];
- //std.stdio.writeln(wd.length);
- foreach (i; 0 .. blockCount)
- {
- //memcpy(&w, &data[i * blockLength], blockLength);
- //auto offset = i * blockSize;
- w[0 .. blockSize] = wd[0 .. blockSize];
- wd = wd[blockSize .. $];
- transform();
- }
- data = data[blockCount * blockLength .. $];
- }
- offset = 0;
- }
- if (data.length)
- {
- //memcpy(&(cast(ubyte[])w)[offset], data.ptr, data.length);
- bw[offset .. offset + data.length] = cast(const(ubyte)[])data;
- offset += data.length;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement