![]() |
question for - Printable Version +- hashcat Forum (https://hashcat.net/forum) +-- Forum: Support (https://hashcat.net/forum/forum-3.html) +--- Forum: hashcat (https://hashcat.net/forum/forum-45.html) +--- Thread: question for (/thread-6547.html) |
question for - alysa - 05-09-2017 here (char prev) is copy semantic,but really faster than (char *prev) ? tip:i'm learning hc, forgive my interesting... hc->src->filehandling.c: u64 count_lines (FILE *fd) { u64 cnt = 0; char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE + 1); char prev = '\n'; while (!feof (fd)) { size_t nread = fread (buf, sizeof (char), HCBUFSIZ_LARGE, fd); if (nread < 1) continue; size_t i; for (i = 0; i < nread; i++) { if (prev == '\n') cnt++; prev = buf[i]; } } hcfree (buf); return cnt; } RE: question for - undeath - 05-09-2017 You could probably even come up with an algorithm that does it with SIMD, but if the overall gain is a 5ms faster hashcat startup that's not really something worth benchmarking and/or optimizing. RE: question for - alysa - 05-09-2017 thank you for all. Y'r right ,but when i draw my private code ,i would prefer to use *,xixi,GL |