mem: reformat using new code style

Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
This commit is contained in:
Marcel Cornu 2024-04-19 17:09:34 +01:00 committed by Pablo de Lara
parent fa5b8baf84
commit aaa78d6a7c
5 changed files with 243 additions and 239 deletions

View File

@ -31,7 +31,8 @@
#include <stddef.h> #include <stddef.h>
#include "unaligned.h" #include "unaligned.h"
int mem_zero_detect_base(void *buf, size_t n) int
mem_zero_detect_base(void *buf, size_t n)
{ {
uint8_t *c = buf; uint8_t *c = buf;
uintmax_t a = 0; uintmax_t a = 0;

View File

@ -30,9 +30,11 @@
#include <stdint.h> #include <stdint.h>
#include "mem_routines.h" #include "mem_routines.h"
int mem_zero_detect_base(void *buf, size_t n); int
mem_zero_detect_base(void *buf, size_t n);
int isal_zero_detect(void *mem, size_t len) int
isal_zero_detect(void *mem, size_t len)
{ {
return mem_zero_detect_base(mem, len); return mem_zero_detect_base(mem, len);
} }

View File

@ -33,10 +33,11 @@
#include "mem_routines.h" #include "mem_routines.h"
#include "test.h" #include "test.h"
#define TEST_LEN 8*1024 #define TEST_LEN 8 * 1024
#define TEST_TYPE_STR "_warm" #define TEST_TYPE_STR "_warm"
int main(int argc, char *argv[]) int
main(int argc, char *argv[])
{ {
int val = 0; int val = 0;
void *buf; void *buf;
@ -53,7 +54,7 @@ int main(int argc, char *argv[])
BENCHMARK(&start, BENCHMARK_TIME, val |= isal_zero_detect(buf, TEST_LEN)); BENCHMARK(&start, BENCHMARK_TIME, val |= isal_zero_detect(buf, TEST_LEN));
printf("mem_zero_detect_perf" TEST_TYPE_STR ": "); printf("mem_zero_detect_perf" TEST_TYPE_STR ": ");
perf_print(start, (long long)TEST_LEN); perf_print(start, (long long) TEST_LEN);
return 0; return 0;
} }

View File

@ -34,19 +34,20 @@
#include "mem_routines.h" #include "mem_routines.h"
#include "test.h" #include "test.h"
#define TEST_MEM 10*1024*1024 #define TEST_MEM 10 * 1024 * 1024
#define TEST_LEN 8*1024 #define TEST_LEN 8 * 1024
#define RAND_ALIGN 32 #define RAND_ALIGN 32
#define BORDER_BYTES (5*RAND_ALIGN + 7) #define BORDER_BYTES (5 * RAND_ALIGN + 7)
#ifndef RANDOMS #ifndef RANDOMS
# define RANDOMS 2000 #define RANDOMS 2000
#endif #endif
#ifndef TEST_SEED #ifndef TEST_SEED
# define TEST_SEED 0x1234 #define TEST_SEED 0x1234
#endif #endif
int main(int argc, char *argv[]) int
main(int argc, char *argv[])
{ {
int i, j, sign; int i, j, sign;
long long r, l; long long r, l;
@ -255,8 +256,7 @@ int main(int argc, char *argv[])
goto exit; goto exit;
} }
if ((r >= l) && (ret_neg != 0)) { if ((r >= l) && (ret_neg != 0)) {
printf("Fail on bad pass zero detect rand %d, l=%lld, e=%lld\n", i, l, printf("Fail on bad pass zero detect rand %d, l=%lld, e=%lld\n", i, l, r);
r);
failures = -1; failures = -1;
goto exit; goto exit;
} }
@ -268,7 +268,7 @@ int main(int argc, char *argv[])
#endif #endif
fflush(0); fflush(0);
exit: exit:
aligned_free(buf); aligned_free(buf);
printf(failures == 0 ? " Pass\n" : " Fail\n"); printf(failures == 0 ? " Pass\n" : " Fail\n");
return failures; return failures;