diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-11-23 19:36:17 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-11-23 19:36:17 +0200 |
commit | 23186e1b806b231b9850644cd1a9470fd468a790 (patch) | |
tree | 96a4b66240b12abb6f019231c58177463272b82b /dfa.c | |
parent | 1b260c0cb01f009057e1ebd362e8a3c4f41772e2 (diff) | |
download | egawk-23186e1b806b231b9850644cd1a9470fd468a790.tar.gz egawk-23186e1b806b231b9850644cd1a9470fd468a790.tar.bz2 egawk-23186e1b806b231b9850644cd1a9470fd468a790.zip |
Merge dfa.c from grep.
Diffstat (limited to 'dfa.c')
-rw-r--r-- | dfa.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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; |