comparison tools/fanalyze.c @ 2268:f2ff364065eb

Add constant define for maximum number of variants.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 17 Jun 2019 10:26:47 +0300
parents 3739e2ac8bb1
children f350c7514785
comparison
equal deleted inserted replaced
2267:3739e2ac8bb1 2268:f2ff364065eb
12 12
13 #define SET_MAX_FILES 64 13 #define SET_MAX_FILES 64
14 #define SET_MAX_ELEMS 256 14 #define SET_MAX_ELEMS 256
15 #define SET_MAX_VALUES 64 15 #define SET_MAX_VALUES 64
16 #define SET_MAX_GREPLIST 64 16 #define SET_MAX_GREPLIST 64
17 #define SET_MAX_VARIANTS 4
17 18
18 #define SET_MAX_SEQUENCES 1024 19 #define SET_MAX_SEQUENCES 1024
19 #define SET_MAX_PLACES 1024 20 #define SET_MAX_PLACES 1024
20 21
21 22
23 */ 24 */
24 typedef struct 25 typedef struct
25 { 26 {
26 Uint8 stats[SET_MAX_ELEMS]; 27 Uint8 stats[SET_MAX_ELEMS];
27 Uint8 variants, data; 28 Uint8 variants, data;
28 int interest[16]; 29 int interest[SET_MAX_VARIANTS];
29 int interestF[16]; 30 int interestF[SET_MAX_VARIANTS];
30 } DMCompElem; 31 } DMCompElem;
31 32
32 33
33 typedef struct 34 typedef struct
34 { 35 {
860 size_t len = file->size > compBufSize ? compBufSize : file->size; 861 size_t len = file->size > compBufSize ? compBufSize : file->size;
861 for (size_t offs = 0; offs + 4 < len; offs++) 862 for (size_t offs = 0; offs + 4 < len; offs++)
862 { 863 {
863 DMCompElem *elem = &compBuf[offs]; 864 DMCompElem *elem = &compBuf[offs];
864 865
865 for (int variant = 3; variant >= 0; variant--) 866 for (int variant = SET_MAX_VARIANTS - 1; variant >= 0; variant--)
866 { 867 {
867 size_t nmax = (variant < 2) ? sizeof(Uint16) : sizeof(Uint32); 868 size_t nmax = (variant < 2) ? sizeof(Uint16) : sizeof(Uint32);
868 Uint32 tmp = 0; 869 Uint32 tmp = 0;
869 870
870 for (size_t n = 0; n < nmax; n++) 871 for (size_t n = 0; n < nmax; n++)
887 printf("\nMore findings:\n"); 888 printf("\nMore findings:\n");
888 for (size_t offs = 0; offs + 4 < compBufSize; offs++) 889 for (size_t offs = 0; offs + 4 < compBufSize; offs++)
889 { 890 {
890 DMCompElem *elem = &compBuf[offs]; 891 DMCompElem *elem = &compBuf[offs];
891 892
892 for (int variant = 0; variant < 4; variant++) 893 for (int variant = 0; variant < SET_MAX_VARIANTS; variant++)
893 if (elem->interestF[variant] > 0) 894 if (elem->interestF[variant] > 0)
894 { 895 {
895 printf("%08" DM_PRIx_SIZE_T " | V%d : %d / %d\n", 896 printf("%08" DM_PRIx_SIZE_T " | V%d : %d / %d\n",
896 offs, variant, 897 offs, variant,
897 elem->interestF[variant], elem->interest[variant]); 898 elem->interestF[variant], elem->interest[variant]);