29
29
#define AC_KSEQ_H
30
30
31
31
#include <ctype.h>
32
+ #include <stdint.h>
32
33
#include <string.h>
33
34
#include <stdlib.h>
34
35
@@ -90,8 +91,12 @@ typedef struct __kstring_t {
90
91
#define kroundup32 (x ) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
91
92
#endif
92
93
94
+ #ifndef kroundup64
95
+ #define kroundup64 (x ) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, (x)|=(x)>>32, ++(x))
96
+ #endif
97
+
93
98
#define __KS_GETUNTIL (__read , __bufsize ) \
94
- static int ks_getuntil2(kstream_t *ks, int delimiter, kstring_t *str, int *dret, int append) \
99
+ static int64_t ks_getuntil2(kstream_t *ks, int delimiter, kstring_t *str, int *dret, int append) \
95
100
{ \
96
101
int gotany = 0; \
97
102
if (dret) *dret = 0; \
@@ -122,7 +127,7 @@ typedef struct __kstring_t {
122
127
} else i = 0; /* never come to here! */ \
123
128
if (str -> m - str -> l < (size_t )(i - ks -> begin + 1 )) { \
124
129
str -> m = str -> l + (i - ks -> begin ) + 1 ; \
125
- kroundup32 (str -> m ); \
130
+ kroundup64 (str -> m ); \
126
131
str -> s = (char * )realloc (str -> s , str -> m ); \
127
132
} \
128
133
gotany = 1 ; \
@@ -175,7 +180,7 @@ typedef struct __kstring_t {
175
180
-3 error reading stream
176
181
*/
177
182
#define __KSEQ_READ (SCOPE ) \
178
- SCOPE int kseq_read(kseq_t *seq) \
183
+ SCOPE int64_t kseq_read(kseq_t *seq) \
179
184
{ \
180
185
int c,r; \
181
186
kstream_t *ks = seq->f; \
@@ -199,7 +204,7 @@ typedef struct __kstring_t {
199
204
if (c == '>' || c == '@' ) seq -> last_char = c ; /* the first header char has been read */ \
200
205
if (seq -> seq .l + 1 >= seq -> seq .m ) { /* seq->seq.s[seq->seq.l] below may be out of boundary */ \
201
206
seq -> seq .m = seq -> seq .l + 2 ; \
202
- kroundup32 (seq -> seq .m ); /* rounded to the next closest 2^k */ \
207
+ kroundup64 (seq -> seq .m ); /* rounded to the next closest 2^k */ \
203
208
seq -> seq .s = (char * )realloc (seq -> seq .s , seq -> seq .m ); \
204
209
} \
205
210
seq -> seq .s [seq -> seq .l ] = 0 ; /* null terminated string */ \
@@ -238,6 +243,6 @@ typedef struct __kstring_t {
238
243
__KSEQ_TYPE(type_t) \
239
244
extern kseq_t *kseq_init(type_t fd); \
240
245
void kseq_destroy(kseq_t *ks); \
241
- int kseq_read(kseq_t *seq);
246
+ int64_t kseq_read(kseq_t *seq);
242
247
243
248
#endif
0 commit comments