Skip to content

Commit 5c670ac

Browse files
committed
py: Be more machine-portable with size of bit fields.
1 parent 4c1a7e0 commit 5c670ac

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

py/mpz.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ typedef int32_t mpz_dbl_dig_signed_t;
6969
typedef struct _mpz_t {
7070
mp_uint_t neg : 1;
7171
mp_uint_t fixed_dig : 1;
72-
mp_uint_t alloc : 30;
72+
mp_uint_t alloc : BITS_PER_WORD - 2;
7373
mp_uint_t len;
7474
mpz_dig_t *dig;
7575
} mpz_t;

py/parse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ STATIC const rule_t *rules[] = {
108108
};
109109

110110
typedef struct _rule_stack_t {
111-
mp_uint_t src_line : 24;
112-
mp_uint_t rule_id : 8;
113-
mp_uint_t arg_i : 32; // what should the bit-size be?
111+
mp_uint_t src_line : BITS_PER_WORD - 8; // maximum bits storing source line number
112+
mp_uint_t rule_id : 8; // this must be large enough to fit largest rule number
113+
mp_uint_t arg_i; // this dictates the maximum nodes in a "list" of things
114114
} rule_stack_t;
115115

116116
typedef struct _parser_t {

0 commit comments

Comments
 (0)