File tree 3 files changed +23
-7
lines changed
3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,32 @@ struct memoryUsage
68
68
69
69
70
70
static size_t getHeaderPad () {
71
- size_t pad = sizeof (uintmax_t ) - (sizeof (struct chunkHeader ) % sizeof (uintmax_t ));
72
- if (pad == sizeof (uintmax_t ))
71
+ size_t alignwith , pad ;
72
+
73
+ if (sizeof (TYPE_OF_WORD ) > sizeof (void * ))
74
+ alignwith = sizeof (TYPE_OF_WORD );
75
+ else
76
+ alignwith = sizeof (void * );
77
+
78
+ pad = alignwith - (sizeof (struct chunkHeader ) % alignwith );
79
+
80
+ if (pad == alignwith )
73
81
return 0 ;
74
82
else
75
83
return pad ;
76
84
}
77
85
78
86
static size_t getTrailerPad (size_t length ) {
79
- size_t pad = sizeof (uintmax_t ) - (length % sizeof (uintmax_t ));
80
- if (pad == sizeof (uintmax_t ))
87
+ size_t alignwith , pad ;
88
+
89
+ if (sizeof (TYPE_OF_WORD ) > sizeof (void * ))
90
+ alignwith = sizeof (TYPE_OF_WORD );
91
+ else
92
+ alignwith = sizeof (void * );
93
+
94
+ pad = alignwith - (length % alignwith );
95
+
96
+ if (pad == alignwith )
81
97
return 0 ;
82
98
else
83
99
return pad ;
Original file line number Diff line number Diff line change 31
31
#include <stdint.h>
32
32
#include <stdio.h>
33
33
34
+ #define TYPE_OF_WORD uintmax_t /* you should choose something big, if you don't want to waste cpu */
35
+
34
36
#include "list-batman.h"
35
37
#include "bitarray.h"
36
38
#include "hash.h"
Original file line number Diff line number Diff line change 21
21
22
22
23
23
24
- #define TYPE_OF_WORD unsigned long /* you should choose something big, if you don't want to waste cpu */
25
- #define WORD_BIT_SIZE ( sizeof(TYPE_OF_WORD) * 8 )
26
24
#include "batman.h"
27
-
25
+ #define WORD_BIT_SIZE ( sizeof(TYPE_OF_WORD) * 8 )
28
26
29
27
30
28
void bit_init ( TYPE_OF_WORD * seq_bits );
You can’t perform that action at this time.
0 commit comments