Commit d59cbb2a17e99158a5399fd5400df1181f79bfe6

Authored by animetosho
1 parent 064156a4

Convert all comments to C-style

include/gf_w4.h
... ... @@ -56,7 +56,7 @@ struct gf_bytwo_data {
56 56 uint64_t mask2;
57 57 };
58 58  
59   -// ARM NEON init functions
  59 +/* ARM NEON init functions */
60 60 int gf_w4_neon_cfm_init(gf_t *gf);
61 61 void gf_w4_neon_single_table_init(gf_t *gf);
62 62  
... ...
src/gf_w128.c
... ... @@ -1167,24 +1167,24 @@ gf_w128_euclid(GFP gf, gf_val_128_t a128, gf_val_128_t b128)
1167 1167 e_i[1] = a128[1];
1168 1168 d_im1 = 128;
1169 1169  
1170   - //Allen: I think d_i starts at 63 here, and checks each bit of a, starting at MSB, looking for the first nonzero bit
1171   - //so d_i should be 0 if this half of a is all 0s, otherwise it should be the position from right of the first-from-left zero bit of this half of a.
1172   - //BUT if d_i is 0 at end we won't know yet if the rightmost bit of this half is 1 or not
  1170 + /*Allen: I think d_i starts at 63 here, and checks each bit of a, starting at MSB, looking for the first nonzero bit
  1171 + *so d_i should be 0 if this half of a is all 0s, otherwise it should be the position from right of the first-from-left zero bit of this half of a.
  1172 + *BUT if d_i is 0 at end we won't know yet if the rightmost bit of this half is 1 or not*/
1173 1173  
1174 1174 for (d_i = (d_im1-1) % 64; ((one << d_i) & e_i[0]) == 0 && d_i > 0; d_i--) ;
1175 1175  
1176   - //Allen: this is testing just the first half of the stop condition above, so if it holds we know we did not find a nonzero bit yet
  1176 + /*Allen: this is testing just the first half of the stop condition above, so if it holds we know we did not find a nonzero bit yet*/
1177 1177  
1178 1178 if (!((one << d_i) & e_i[0])) {
1179 1179  
1180   - //Allen: this is doing the same thing on the other half of a. In other words, we're still searching for a nonzero bit of a.
1181   - // but not bothering to test if d_i hits zero, which is fine because we've already tested for a=0.
  1180 + /*Allen: this is doing the same thing on the other half of a. In other words, we're still searching for a nonzero bit of a.
  1181 + *but not bothering to test if d_i hits zero, which is fine because we've already tested for a=0.*/
1182 1182  
1183 1183 for (d_i = (d_im1-1) % 64; ((one << d_i) & e_i[1]) == 0; d_i--) ;
1184 1184  
1185 1185 } else {
1186 1186  
1187   - //Allen: if a 1 was found in more-significant half of a, make d_i the ACTUAL index of the first nonzero bit in the entire a.
  1187 + /*Allen: if a 1 was found in more-significant half of a, make d_i the ACTUAL index of the first nonzero bit in the entire a.*/
1188 1188  
1189 1189 d_i += 64;
1190 1190 }
... ... @@ -1488,7 +1488,7 @@ void gf_w128_group_r_init(gf_t *gf)
1488 1488 return;
1489 1489 }
1490 1490  
1491   -#if 0 // defined(INTEL_SSE4)
  1491 +#if 0 /* defined(INTEL_SSE4) */
1492 1492 static
1493 1493 void gf_w128_group_r_sse_init(gf_t *gf)
1494 1494 {
... ...
src/gf_w16.c
... ... @@ -897,7 +897,7 @@ gf_w16_split_8_16_lazy_multiply_region(gf_t *gf, void *src, void *dest, gf_val_3
897 897 a <<= 8;
898 898 }
899 899  
900   - //JSP: We can move the conditional outside the while loop, but we need to fully test it to understand which is better.
  900 + /*JSP: We can move the conditional outside the while loop, but we need to fully test it to understand which is better.*/
901 901  
902 902 prod ^= ((xor) ? *d64 : 0);
903 903 *d64 = prod;
... ...
src/gf_w4.c
... ... @@ -19,7 +19,7 @@
19 19 t2 = ((t2 << 1) - (t2 >> (GF_FIELD_WIDTH-1))); \
20 20 b = (t1 ^ (t2 & ip));}
21 21  
22   -// ToDo(KMG/JSP): Why is 0x88 hard-coded?
  22 +/* ToDo(KMG/JSP): Why is 0x88 hard-coded? */
23 23 #define SSE_AB2(pp, m1, va, t1, t2) {\
24 24 t1 = _mm_and_si128(_mm_slli_epi64(va, 1), m1); \
25 25 t2 = _mm_and_si128(va, _mm_set1_epi8(0x88)); \
... ...
src/gf_w64.c
... ... @@ -2029,7 +2029,7 @@ int gf_w64_split_init(gf_t *gf)
2029 2029 return 0;
2030 2030 #endif
2031 2031 }
2032   - else //no altmap
  2032 + else /*no altmap*/
2033 2033 {
2034 2034 #if defined(INTEL_SSE4) || defined(ARCH_AARCH64)
2035 2035 if(h->region_type & GF_REGION_NOSIMD)
... ...
src/gf_wgen.c
... ... @@ -662,7 +662,7 @@ int gf_wgen_log_8_init(gf_t *gf)
662 662 a <<= 1;
663 663 if(a & (1<<w))
664 664 a ^= h->prim_poly;
665   - //a &= ((1 << w)-1);
  665 + /*a &= ((1 << w)-1);*/
666 666 }
667 667  
668 668 if (check != 0) {
... ... @@ -737,7 +737,7 @@ int gf_wgen_log_16_init(gf_t *gf)
737 737 a <<= 1;
738 738 if(a & (1<<w))
739 739 a ^= h->prim_poly;
740   - //a &= ((1 << w)-1);
  740 + /*a &= ((1 << w)-1);*/
741 741 }
742 742  
743 743 if (check) {
... ... @@ -813,7 +813,7 @@ int gf_wgen_log_32_init(gf_t *gf)
813 813 a <<= 1;
814 814 if(a & (1<<w))
815 815 a ^= h->prim_poly;
816   - //a &= ((1 << w)-1);
  816 + /*a &= ((1 << w)-1);*/
817 817 }
818 818  
819 819 if (check != 0) {
... ...
src/neon/gf_w4_neon.c
... ... @@ -234,7 +234,7 @@ gf_w4_single_table_multiply_region_neon(gf_t *gf, void *src, void *dest,
234 234  
235 235 int gf_w4_neon_cfm_init(gf_t *gf)
236 236 {
237   - // single clm multiplication probably pointless
  237 + /* single clm multiplication probably pointless */
238 238 gf->multiply.w32 = gf_w4_neon_clm_multiply;
239 239 gf->multiply_region.w32 = gf_w4_neon_clm_multiply_region_from_single;
240 240  
... ...
test/gf_unit.c
... ... @@ -137,7 +137,7 @@ int main(int argc, char **argv)
137 137 if (posix_memalign((void **) &rd, 16, sizeof(char)*REGION_SIZE))
138 138 rd = NULL;
139 139 #else
140   - //15 bytes extra to make sure it's 16byte aligned
  140 + /*15 bytes extra to make sure it's 16byte aligned*/
141 141 malloc_ra = (char *) malloc(sizeof(char)*REGION_SIZE+15);
142 142 malloc_rb = (char *) malloc(sizeof(char)*REGION_SIZE+15);
143 143 malloc_rc = (char *) malloc(sizeof(char)*REGION_SIZE+15);
... ... @@ -186,9 +186,9 @@ int main(int argc, char **argv)
186 186 a->w32 = i % (1 << w);
187 187 b->w32 = (i >> w);
188 188  
189   - //Allen: the following conditions were being run 10 times each. That didn't seem like nearly enough to
190   - //me for these special cases, so I converted to doing this mod stuff to easily make the number of times
191   - //run both larger and proportional to the total size of the run.
  189 + /*Allen: the following conditions were being run 10 times each. That didn't seem like nearly enough to
  190 + *me for these special cases, so I converted to doing this mod stuff to easily make the number of times
  191 + *run both larger and proportional to the total size of the run.*/
192 192 } else {
193 193 switch (i % 32)
194 194 {
... ... @@ -214,11 +214,11 @@ int main(int argc, char **argv)
214 214 }
215 215 }
216 216  
217   - //Allen: the following special cases for w=64 are based on the code below for w=128.
218   - //These w=64 cases are based on Dr. Plank's suggestion because some of the methods for w=64
219   - //involve splitting it in two. I think they're less likely to give errors than the 128-bit case
220   - //though, because the 128 bit case is always split in two.
221   - //As with w=128, I'm arbitrarily deciding to do this sort of thing with a quarter of the cases
  217 + /*Allen: the following special cases for w=64 are based on the code below for w=128.
  218 + *These w=64 cases are based on Dr. Plank's suggestion because some of the methods for w=64
  219 + *involve splitting it in two. I think they're less likely to give errors than the 128-bit case
  220 + *though, because the 128 bit case is always split in two.
  221 + *As with w=128, I'm arbitrarily deciding to do this sort of thing with a quarter of the cases*/
222 222 if (w == 64) {
223 223 switch (i % 32)
224 224 {
... ... @@ -233,11 +233,11 @@ int main(int argc, char **argv)
233 233 }
234 234 }
235 235  
236   - //Allen: for w=128, we have important special cases where one half or the other of the number is all
237   - //zeros. The probability of hitting such a number randomly is 1^-64, so if we don't force these cases
238   - //we'll probably never hit them. This could be implemented more efficiently by changing the set-random
239   - //function for w=128, but I think this is easier to follow.
240   - //I'm arbitrarily deciding to do this sort of thing with a quarter of the cases
  236 + /*Allen: for w=128, we have important special cases where one half or the other of the number is all
  237 + *zeros. The probability of hitting such a number randomly is 1^-64, so if we don't force these cases
  238 + *we'll probably never hit them. This could be implemented more efficiently by changing the set-random
  239 + *function for w=128, but I think this is easier to follow.
  240 + *I'm arbitrarily deciding to do this sort of thing with a quarter of the cases*/
241 241 if (w == 128) {
242 242 switch (i % 32)
243 243 {
... ... @@ -360,7 +360,7 @@ int main(int argc, char **argv)
360 360 if (region) {
361 361 if (verbose) { printf("Testing region multiplications\n"); fflush(stdout); }
362 362 for (i = 0; i < 1024; i++) {
363   - //Allen: changing to a switch thing as with the single ops to make things proportional
  363 + /*Allen: changing to a switch thing as with the single ops to make things proportional*/
364 364 switch (i % 32)
365 365 {
366 366 case 0:
... ...
tools/gf_poly.c
... ... @@ -210,7 +210,7 @@ int main(int argc, char **argv)
210 210 n = power;
211 211 }
212 212 }
213   - // in case the for-loop header fails
  213 + /* in case the for-loop header fails */
214 214 assert (n >= 0);
215 215  
216 216 poly = (gf_general_t *) malloc(sizeof(gf_general_t)*(n+1));
... ...