Test and bugfixes for XorErasureEncoder.

This commit is contained in:
akwizgran
2012-01-20 16:29:22 +00:00
parent f10af33b6f
commit 2b737e7e53
3 changed files with 44 additions and 2 deletions

View File

@@ -21,8 +21,8 @@ class XorErasureEncoder implements ErasureEncoder {
byte[] src = f.getBuffer(), parity = set[n - 1].getBuffer();
int offset = 0;
for(int i = 0; i < n - 1; i++) {
System.arraycopy(src, 0, set[i].getBuffer(), offset, length);
for(int j = 0; j < length; j++) parity[j] ^= src[j];
System.arraycopy(src, offset, set[i].getBuffer(), 0, length);
for(int j = 0; j < length; j++) parity[j] ^= src[offset + j];
offset += length;
}
return set;