summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin Greenan <kmgreen2@gmail.com>2013-12-20 08:21:46 -0800
committerKevin Greenan <kmgreen2@gmail.com>2013-12-20 08:21:46 -0800
commitc4ab254bbce42e6df9c89aee11ddb459bc86f4d0 (patch)
treeb16d24659b293f9ba94bf706a987db02e49eb28c /src
parent1733366245241ad15931ea1e9f0e382022848ef2 (diff)
downloadjerasure-c4ab254bbce42e6df9c89aee11ddb459bc86f4d0.tar.gz
Do SIMD XOR, where possible!
Diffstat (limited to 'src')
-rw-r--r--src/galois.c24
-rw-r--r--src/jerasure.c8
-rw-r--r--src/reed_sol.c4
3 files changed, 8 insertions, 28 deletions
diff --git a/src/galois.c b/src/galois.c
index b05de8e..2382a2b 100644
--- a/src/galois.c
+++ b/src/galois.c
@@ -324,29 +324,9 @@ void galois_w32_region_xor(void *src, void *dest, int nbytes)
gfp_array[32]->multiply_region.w32(gfp_array[32], src, dest, 1, nbytes, 1);
}
-void galois_region_xor(char *r1, /* Region 1 */
- char *r2, /* Region 2 */
- char *r3, /* Sum region (r3 = r1 ^ r2) -- can be r1 or r2 */
- int nbytes) /* Number of bytes in region */
+void galois_region_xor(char *src, char *dest, int nbytes)
{
- long *l1;
- long *l2;
- long *l3;
- long *ltop;
- char *ctop;
-
- ctop = r1 + nbytes;
- ltop = (long *) ctop;
- l1 = (long *) r1;
- l2 = (long *) r2;
- l3 = (long *) r3;
-
- while (l1 < ltop) {
- *l3 = ((*l1) ^ (*l2));
- l1++;
- l2++;
- l3++;
- }
+ galois_w32_region_xor(src, dest, nbytes);
}
int galois_inverse(int y, int w)
diff --git a/src/jerasure.c b/src/jerasure.c
index 8578086..21784ac 100644
--- a/src/jerasure.c
+++ b/src/jerasure.c
@@ -341,7 +341,7 @@ void jerasure_bitmatrix_dotprod(int k, int w, int *bitmatrix_row,
jerasure_total_memcpy_bytes += packetsize;
pstarted = 1;
} else {
- galois_region_xor(pptr, dptr, pptr, packetsize);
+ galois_region_xor(dptr, pptr, packetsize);
jerasure_total_xor_bytes += packetsize;
}
}
@@ -360,7 +360,7 @@ void jerasure_do_parity(int k, char **data_ptrs, char *parity_ptr, int size)
jerasure_total_memcpy_bytes += size;
for (i = 1; i < k; i++) {
- galois_region_xor(data_ptrs[i], parity_ptr, parity_ptr, size);
+ galois_region_xor(data_ptrs[i], parity_ptr, size);
jerasure_total_xor_bytes += size;
}
}
@@ -599,7 +599,7 @@ void jerasure_matrix_dotprod(int k, int w, int *matrix_row,
jerasure_total_memcpy_bytes += size;
init = 1;
} else {
- galois_region_xor(sptr, dptr, dptr, size);
+ galois_region_xor(sptr, dptr, size);
jerasure_total_xor_bytes += size;
}
}
@@ -1173,7 +1173,7 @@ void jerasure_do_scheduled_operations(char **ptrs, int **operations, int packets
operations[op][2],
operations[op][3]);
printf("xor(0x%x, 0x%x -> 0x%x, %d)\n", sptr, dptr, dptr, packetsize); */
- galois_region_xor(sptr, dptr, dptr, packetsize);
+ galois_region_xor(sptr, dptr, packetsize);
jerasure_total_xor_bytes += packetsize;
} else {
/* printf("memcpy(0x%x <- 0x%x)\n", dptr, sptr); */
diff --git a/src/reed_sol.c b/src/reed_sol.c
index bba8d0d..77407f3 100644
--- a/src/reed_sol.c
+++ b/src/reed_sol.c
@@ -213,7 +213,7 @@ int reed_sol_r6_encode(int k, int w, char **data_ptrs, char **coding_ptrs, int s
memcpy(coding_ptrs[0], data_ptrs[0], size);
- for (i = 1; i < k; i++) galois_region_xor(coding_ptrs[0], data_ptrs[i], coding_ptrs[0], size);
+ for (i = 1; i < k; i++) galois_region_xor(data_ptrs[i], coding_ptrs[0], size);
/* Next, put the sum of (2^j)*Dj into coding region 1 */
@@ -227,7 +227,7 @@ int reed_sol_r6_encode(int k, int w, char **data_ptrs, char **coding_ptrs, int s
default: return 0;
}
- galois_region_xor(coding_ptrs[1], data_ptrs[i], coding_ptrs[1], size);
+ galois_region_xor(data_ptrs[i], coding_ptrs[1], size);
}
return 1;
}