aboutsummaryrefslogtreecommitdiffstats
path: root/dfa.c
diff options
context:
space:
mode:
Diffstat (limited to 'dfa.c')
-rw-r--r--dfa.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/dfa.c b/dfa.c
index b4972303..f3ea877c 100644
--- a/dfa.c
+++ b/dfa.c
@@ -125,7 +125,7 @@ extern int gawk_mb_cur_max;
#define CHARCLASS_INTS ((NOTCHAR + INTBITS - 1) / INTBITS)
/* Sets of unsigned characters are stored as bit vectors in arrays of ints. */
-typedef int charclass[CHARCLASS_INTS];
+typedef unsigned int charclass[CHARCLASS_INTS];
/* Convert a possibly-signed character to an unsigned character. This is
a bit safer than casting to unsigned char, since it catches some type
@@ -585,22 +585,22 @@ prtok (token t)
/* Stuff pertaining to charclasses. */
-static int
+static bool
tstbit (unsigned int b, charclass const c)
{
- return c[b / INTBITS] & 1 << b % INTBITS;
+ return c[b / INTBITS] >> b % INTBITS & 1;
}
static void
setbit (unsigned int b, charclass c)
{
- c[b / INTBITS] |= 1 << b % INTBITS;
+ c[b / INTBITS] |= 1U << b % INTBITS;
}
static void
clrbit (unsigned int b, charclass c)
{
- c[b / INTBITS] &= ~(1 << b % INTBITS);
+ c[b / INTBITS] &= ~(1U << b % INTBITS);
}
static void
@@ -2791,7 +2791,7 @@ dfastate (state_num s, struct dfa *d, state_num trans[])
/* Set the transitions for each character in the current label. */
for (j = 0; j < CHARCLASS_INTS; ++j)
for (k = 0; k < INTBITS; ++k)
- if (labels[i][j] & 1 << k)
+ if (labels[i][j] & 1U << k)
{
int c = j * INTBITS + k;