From: Reuben Thomas Date: Sun, 14 Jan 2018 22:04:05 +0000 (+0000) Subject: Rename MASK macro to BIT_MASK to avoid clash with Python headers X-Git-Tag: v3.7~133 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4bea068fcc7388e30271579fe309aa0a486b5991;p=recode Rename MASK macro to BIT_MASK to avoid clash with Python headers --- diff --git a/src/base64.c b/src/base64.c index a53a12a..7afd8be 100644 --- a/src/base64.c +++ b/src/base64.c @@ -98,8 +98,8 @@ transform_data_base64 (RECODE_SUBTASK subtask) /* Process first byte of a triplet. */ - put_byte (base64_value_to_char[MASK (6) & character >> 2], subtask); - value = (MASK (2) & character) << 4; + put_byte (base64_value_to_char[BIT_MASK (6) & character >> 2], subtask); + value = (BIT_MASK (2) & character) << 4; /* Process second byte of a triplet. */ @@ -111,9 +111,9 @@ transform_data_base64 (RECODE_SUBTASK subtask) put_byte ('=', subtask); break; } - put_byte (base64_value_to_char[value | (MASK (4) & character >> 4)], + put_byte (base64_value_to_char[value | (BIT_MASK (4) & character >> 4)], subtask); - value = (MASK (4) & character) << 2; + value = (BIT_MASK (4) & character) << 2; /* Process third byte of a triplet. */ @@ -124,9 +124,9 @@ transform_data_base64 (RECODE_SUBTASK subtask) put_byte ('=', subtask); break; } - put_byte (base64_value_to_char[value | (MASK (2) & character >> 6)], + put_byte (base64_value_to_char[value | (BIT_MASK (2) & character >> 6)], subtask); - put_byte (base64_value_to_char[MASK (6) & character], subtask); + put_byte (base64_value_to_char[BIT_MASK (6) & character], subtask); } /* Complete last partial line. */ @@ -221,7 +221,7 @@ transform_base64_data (RECODE_SUBTASK subtask) else RETURN_IF_NOGO (RECODE_INVALID_INPUT, subtask); - put_byte (MASK (8) & value >> 8, subtask); + put_byte (BIT_MASK (8) & value >> 8, subtask); /* Process fourth byte of a quadruplet. */ @@ -240,7 +240,7 @@ transform_base64_data (RECODE_SUBTASK subtask) else RETURN_IF_NOGO (RECODE_INVALID_INPUT, subtask); - put_byte (MASK (8) & value, subtask); + put_byte (BIT_MASK (8) & value, subtask); } } diff --git a/src/common.h b/src/common.h index 1aed7b8..247ca55 100644 --- a/src/common.h +++ b/src/common.h @@ -47,11 +47,11 @@ #define N_(Text) Text /* Generate a mask of LENGTH one-bits, right justified in a word. */ -#define MASK(Length) ((unsigned) ~(~0 << (Length))) +#define BIT_MASK(Length) ((unsigned) ~(~0 << (Length))) /* Indicate if CHARACTER holds into 7 bits. */ #define IS_ASCII(Character) \ - (!((Character) & ~MASK (7))) + (!((Character) & ~BIT_MASK (7))) /* Debugging the memory allocator. */ #if WITH_DMALLOC diff --git a/src/dump.c b/src/dump.c index f49fdc6..956ec80 100644 --- a/src/dump.c +++ b/src/dump.c @@ -62,7 +62,7 @@ dump (RECODE_SUBTASK subtask, while (character != EOF) { - unsigned value = MASK (8) & character; + unsigned value = BIT_MASK (8) & character; unsigned byte_count; char buffer[14]; const char *cursor; @@ -72,7 +72,7 @@ dump (RECODE_SUBTASK subtask, character = get_byte (subtask); if (character == EOF) break; - value = (value << 8) | (MASK (8) & character); + value = (value << 8) | (BIT_MASK (8) & character); } /* Write delimiters. */ @@ -284,7 +284,7 @@ undump (RECODE_SUBTASK subtask, /* Produce the output bytes. */ for (unsigned shift = size; shift != 0; shift--) - put_byte (MASK (8) & value >> ((shift * 8) - 8), subtask); + put_byte (BIT_MASK (8) & value >> ((shift * 8) - 8), subtask); } /* Skip separators. */ diff --git a/src/flat.c b/src/flat.c index dd6efc1..6c824a0 100644 --- a/src/flat.c +++ b/src/flat.c @@ -85,9 +85,9 @@ transform_ascii_flat (RECODE_SUBTASK subtask) RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); put_byte ('M', subtask); put_byte ('-', subtask); - input_char &= MASK (7); + input_char &= BIT_MASK (7); } - if (input_char < ' ' || input_char == MASK (7)) + if (input_char < ' ' || input_char == BIT_MASK (7)) { RETURN_IF_NOGO (RECODE_AMBIGUOUS_OUTPUT, subtask); put_byte ('^', subtask); diff --git a/src/mule.c b/src/mule.c index a1df8f8..e74be15 100644 --- a/src/mule.c +++ b/src/mule.c @@ -44,11 +44,11 @@ transform_mule_latin (RECODE_SUBTASK subtask, while (character = get_byte (subtask), character != EOF) if (IS_ASCII (character)) put_byte (character, subtask); - else if ((character & MASK (8)) == prefix) + else if ((character & BIT_MASK (8)) == prefix) { character = get_byte (subtask); - while ((character & MASK (8)) == prefix) + while ((character & BIT_MASK (8)) == prefix) { /* This happens in practice, sometimes, that Emacs goes a bit berzerk and generates strings of prefix characters. Remove diff --git a/src/names.c b/src/names.c index c3583a1..cb14b72 100644 --- a/src/names.c +++ b/src/names.c @@ -34,7 +34,7 @@ code_to_ucs2 (RECODE_CONST_SYMBOL charset, unsigned code) unsigned offset = data->offset[code / STRIP_SIZE]; unsigned value = pool[offset + code % STRIP_SIZE]; - return value == MASK (16) ? -1 : (int) value; + return value == BIT_MASK (16) ? -1 : (int) value; } /*---------------------------------------------------------. @@ -1135,7 +1135,7 @@ find_and_report_subsets (RECODE_OUTER outer) if (value1 != value2) { - if (value1 == MASK (16)) + if (value1 == BIT_MASK (16)) distance++; else { diff --git a/src/quoted.c b/src/quoted.c index b825809..710fb64 100644 --- a/src/quoted.c +++ b/src/quoted.c @@ -57,9 +57,9 @@ static const char safe_char_bitnet[1 << 7] = unsigned nibble; \ \ put_byte ('=', subtask); \ - nibble = MASK (4) & (Character) >> 4; \ + nibble = BIT_MASK (4) & (Character) >> 4; \ put_byte ((nibble < 10 ? '0' : 'A' - 10) + nibble, subtask); \ - nibble = MASK (4) & (Character); \ + nibble = BIT_MASK (4) & (Character); \ put_byte ((nibble < 10 ? '0' : 'A' - 10) + nibble, subtask); \ } while (false) diff --git a/src/request.c b/src/request.c index 7cad952..95b1a3c 100644 --- a/src/request.c +++ b/src/request.c @@ -473,7 +473,7 @@ complete_double_ucs2_step (RECODE_OUTER outer, RECODE_STEP step) { unsigned code = pool[offset + position_counter]; - if (code != MASK (16)) + if (code != BIT_MASK (16)) { /* Establish a new binding item. */ item_cursor->byte = byte; diff --git a/src/rfc1345.c b/src/rfc1345.c index 704cd29..dbfac2d 100644 --- a/src/rfc1345.c +++ b/src/rfc1345.c @@ -53,7 +53,7 @@ ucs2_to_rfc1345 (recode_ucs2 code) /*---------------------------------------------------------------------. | Return an UCS-2 value, given an RFC 1345 short form in a CHARSET, or | -| MASK (16) if the short form is unknown. | +| BIT_MASK (16) if the short form is unknown. | `---------------------------------------------------------------------*/ static _GL_ATTRIBUTE_PURE recode_ucs2 diff --git a/src/task.c b/src/task.c index 52fdbd0..75e5ee7 100644 --- a/src/task.c +++ b/src/task.c @@ -616,8 +616,8 @@ perform_pipe_sequence (RECODE_TASK task) || (WIFSIGNALED (wait_status) && WTERMSIG (wait_status) == SIGPIPE))) #endif - if ((wait_status & MASK (8)) != 0 - && (wait_status & MASK (8)) != SIGPIPE) + if ((wait_status & BIT_MASK (8)) != 0 + && (wait_status & BIT_MASK (8)) != SIGPIPE) { recode_error (outer, _("Child process wait status is 0x%0.2x"), wait_status); diff --git a/src/ucs.c b/src/ucs.c index be73ecf..dd9329e 100644 --- a/src/ucs.c +++ b/src/ucs.c @@ -396,7 +396,7 @@ get_ucs2 (unsigned *value, RECODE_SUBTASK subtask) switch (subtask->task->swap_input) { case RECODE_SWAP_UNDECIDED: - chunk = ((MASK (8) & character1) << 8) | (MASK (8) & character2); + chunk = ((BIT_MASK (8) & character1) << 8) | (BIT_MASK (8) & character2); switch (chunk) { case BYTE_ORDER_MARK: @@ -417,7 +417,7 @@ get_ucs2 (unsigned *value, RECODE_SUBTASK subtask) break; case RECODE_SWAP_NO: - chunk = ((MASK (8) & character1) << 8) | (MASK (8) & character2); + chunk = ((BIT_MASK (8) & character1) << 8) | (BIT_MASK (8) & character2); switch (chunk) { case BYTE_ORDER_MARK: @@ -436,7 +436,7 @@ get_ucs2 (unsigned *value, RECODE_SUBTASK subtask) break; case RECODE_SWAP_YES: - chunk = ((MASK (8) & character2) << 8) | (MASK (8) & character1); + chunk = ((BIT_MASK (8) & character2) << 8) | (BIT_MASK (8) & character1); switch (chunk) { case BYTE_ORDER_MARK: @@ -467,8 +467,8 @@ get_ucs2 (unsigned *value, RECODE_SUBTASK subtask) bool put_ucs2 (unsigned value, RECODE_SUBTASK subtask) { - put_byte (MASK (8) & value >> 8, subtask); - put_byte (MASK (8) & value, subtask); + put_byte (BIT_MASK (8) & value >> 8, subtask); + put_byte (BIT_MASK (8) & value, subtask); return true; } @@ -487,7 +487,7 @@ get_ucs4 (unsigned *value, RECODE_SUBTASK subtask) character = get_byte (subtask); if (character == EOF) return false; - chunk = (MASK (8) & character) << 24; + chunk = (BIT_MASK (8) & character) << 24; character = get_byte (subtask); if (character == EOF) @@ -495,7 +495,7 @@ get_ucs4 (unsigned *value, RECODE_SUBTASK subtask) SET_SUBTASK_ERROR (RECODE_INVALID_INPUT, subtask); return false; } - chunk |= (MASK (8) & character) << 16; + chunk |= (BIT_MASK (8) & character) << 16; character = get_byte (subtask); if (character == EOF) @@ -503,7 +503,7 @@ get_ucs4 (unsigned *value, RECODE_SUBTASK subtask) SET_SUBTASK_ERROR (RECODE_INVALID_INPUT, subtask); return false; } - chunk |= (MASK (8) & character) << 8; + chunk |= (BIT_MASK (8) & character) << 8; character = get_byte (subtask); if (character == EOF) @@ -511,7 +511,7 @@ get_ucs4 (unsigned *value, RECODE_SUBTASK subtask) SET_SUBTASK_ERROR (RECODE_INVALID_INPUT, subtask); return false; } - chunk |= MASK (8) & character; + chunk |= BIT_MASK (8) & character; *value = chunk; return true; @@ -524,10 +524,10 @@ get_ucs4 (unsigned *value, RECODE_SUBTASK subtask) bool put_ucs4 (unsigned value, RECODE_SUBTASK subtask) { - put_byte (MASK (8) & value >> 24, subtask); - put_byte (MASK (8) & value >> 16, subtask); - put_byte (MASK (8) & value >> 8, subtask); - put_byte (MASK (8) & value, subtask); + put_byte (BIT_MASK (8) & value >> 24, subtask); + put_byte (BIT_MASK (8) & value >> 16, subtask); + put_byte (BIT_MASK (8) & value >> 8, subtask); + put_byte (BIT_MASK (8) & value, subtask); return true; } @@ -569,7 +569,7 @@ transform_latin1_ucs4 (RECODE_SUBTASK subtask) int character; while (character = get_byte (subtask), character != EOF) - put_ucs4 (MASK (8) & character, subtask); + put_ucs4 (BIT_MASK (8) & character, subtask); SUBTASK_RETURN (subtask); } diff --git a/src/utf16.c b/src/utf16.c index 9a21632..4c08e0f 100644 --- a/src/utf16.c +++ b/src/utf16.c @@ -32,14 +32,14 @@ transform_ucs4_utf16 (RECODE_SUBTASK subtask) while (true) { - if (value & ~MASK (16)) + if (value & ~BIT_MASK (16)) if (value < (1 << 16 | 1 << 20)) { /* Double UCS-2 character. */ value -= 1 << 16; - put_ucs2 (0xD800 | (MASK (10) & value >> 10), subtask); - put_ucs2 (0xDC00 | (MASK (10) & value), subtask); + put_ucs2 (0xD800 | (BIT_MASK (10) & value >> 10), subtask); + put_ucs2 (0xDC00 | (BIT_MASK (10) & value), subtask); } else { diff --git a/src/utf7.c b/src/utf7.c index e9d7aa3..3f664f2 100644 --- a/src/utf7.c +++ b/src/utf7.c @@ -96,9 +96,9 @@ transform_utf16_utf7 (RECODE_SUBTASK subtask) /* Process first UCS-2 value of a triplet. */ - put_byte (base64_value_to_char[MASK (6) & value >> 10], subtask); - put_byte (base64_value_to_char[MASK (6) & value >> 4], subtask); - split = (value & MASK (4)) << 2; + put_byte (base64_value_to_char[BIT_MASK (6) & value >> 10], subtask); + put_byte (base64_value_to_char[BIT_MASK (6) & value >> 4], subtask); + split = (value & BIT_MASK (4)) << 2; if (!get_ucs2 (&value, subtask)) { put_byte (base64_value_to_char[split], subtask); @@ -112,11 +112,11 @@ transform_utf16_utf7 (RECODE_SUBTASK subtask) put_byte (base64_value_to_char[split], subtask); break; } - put_byte (base64_value_to_char[split | (MASK (2) & value >> 14)], + put_byte (base64_value_to_char[split | (BIT_MASK (2) & value >> 14)], subtask); - put_byte (base64_value_to_char[MASK (6) & value >> 8], subtask); - put_byte (base64_value_to_char[MASK (6) & value >> 2], subtask); - split = (value & MASK (2)) << 4; + put_byte (base64_value_to_char[BIT_MASK (6) & value >> 8], subtask); + put_byte (base64_value_to_char[BIT_MASK (6) & value >> 2], subtask); + split = (value & BIT_MASK (2)) << 4; if (!get_ucs2 (&value, subtask)) { put_byte (base64_value_to_char[split], subtask); @@ -130,10 +130,10 @@ transform_utf16_utf7 (RECODE_SUBTASK subtask) put_byte (base64_value_to_char[split], subtask); break; } - put_byte (base64_value_to_char[split | (MASK (4) & value >> 12)], + put_byte (base64_value_to_char[split | (BIT_MASK (4) & value >> 12)], subtask); - put_byte (base64_value_to_char[MASK (6) & value >> 6], subtask); - put_byte (base64_value_to_char[MASK (6) & value], subtask); + put_byte (base64_value_to_char[BIT_MASK (6) & value >> 6], subtask); + put_byte (base64_value_to_char[BIT_MASK (6) & value], subtask); if (!get_ucs2 (&value, subtask)) SUBTASK_RETURN (subtask); } @@ -196,11 +196,11 @@ transform_utf7_utf16 (RECODE_SUBTASK subtask) if (!IS_BASE64 (character)) { - if (MASK (2) & split) + if (BIT_MASK (2) & split) RETURN_IF_NOGO (RECODE_INVALID_INPUT, subtask); break; } - value = ((MASK (2) & split) << 14 + value = ((BIT_MASK (2) & split) << 14 | base64_char_to_value[character] << 8); character = get_byte (subtask); @@ -232,11 +232,11 @@ transform_utf7_utf16 (RECODE_SUBTASK subtask) if (!IS_BASE64 (character)) { - if (MASK (4) & split) + if (BIT_MASK (4) & split) RETURN_IF_NOGO (RECODE_INVALID_INPUT, subtask); break; } - value = ((MASK (4) & split) << 12 + value = ((BIT_MASK (4) & split) << 12 | base64_char_to_value[character] << 6); character = get_byte (subtask); diff --git a/src/utf8.c b/src/utf8.c index 389c704..f821d7f 100644 --- a/src/utf8.c +++ b/src/utf8.c @@ -33,7 +33,7 @@ RETURN_IF_NOGO (RECODE_INVALID_INPUT, subtask); \ break; \ } \ - else if ((MASK (2) << 6 & character) != 1 << 7) \ + else if ((BIT_MASK (2) << 6 & character) != 1 << 7) \ { \ RETURN_IF_NOGO (RECODE_INVALID_INPUT, subtask); \ continue; \ @@ -44,7 +44,7 @@ Merge it into `value' at POSITION. This macro is meant to be used only within the `while' loop in `transform_utf8_ucs[24]'. */ #define GET_DATA_BYTE_AT(Position) \ - GET_DATA_BYTE /* ... else */ value |= (MASK (6) & character) << Position + GET_DATA_BYTE /* ... else */ value |= (BIT_MASK (6) & character) << Position static bool transform_ucs2_utf8 (RECODE_SUBTASK subtask) @@ -53,19 +53,19 @@ transform_ucs2_utf8 (RECODE_SUBTASK subtask) while (get_ucs2 (&value, subtask)) { - if (value & ~MASK (7)) - if (value & ~MASK (11)) + if (value & ~BIT_MASK (7)) + if (value & ~BIT_MASK (11)) { /* 3 bytes - more than 11 bits, but not more than 16. */ - put_byte ((MASK (3) << 5) | (MASK (6) & value >> 12), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 6), subtask); - put_byte ((1 << 7) | (MASK (6) & value), subtask); + put_byte ((BIT_MASK (3) << 5) | (BIT_MASK (6) & value >> 12), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 6), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value), subtask); } else { /* 2 bytes - more than 7 bits, but not more than 11. */ - put_byte ((MASK (2) << 6) | (MASK (6) & value >> 6), subtask); - put_byte ((1 << 7) | (MASK (6) & value), subtask); + put_byte ((BIT_MASK (2) << 6) | (BIT_MASK (6) & value >> 6), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value), subtask); } else /* 1 byte - not more than 7 bits (that is, ASCII). */ @@ -81,19 +81,19 @@ transform_ucs4_utf8 (RECODE_SUBTASK subtask) unsigned value; while (get_ucs4 (&value, subtask)) - if (value & ~MASK (16)) - if (value & ~MASK (26)) - if (value & ~MASK (31)) + if (value & ~BIT_MASK (16)) + if (value & ~BIT_MASK (26)) + if (value & ~BIT_MASK (31)) { #if HANDLE_32_BITS /* 7 bytes - more than 31 bits (that is, exactly 32 :-). */ - put_byte (MASK (7) << 1); - put_byte ((1 << 7) | (MASK (6) & value >> 30), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 24), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 18), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 12), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 6), subtask); - put_byte ((1 << 7) | (MASK (6) & value), subtask); + put_byte (BIT_MASK (7) << 1); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 30), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 24), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 18), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 12), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 6), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value), subtask); #else RETURN_IF_NOGO (RECODE_INVALID_INPUT, subtask); #endif @@ -101,43 +101,43 @@ transform_ucs4_utf8 (RECODE_SUBTASK subtask) else { /* 6 bytes - more than 26 bits, but not more than 31. */ - put_byte ((MASK (6) << 2) | (MASK (6) & value >> 30), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 24), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 18), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 12), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 6), subtask); - put_byte ((1 << 7) | (MASK (6) & value), subtask); + put_byte ((BIT_MASK (6) << 2) | (BIT_MASK (6) & value >> 30), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 24), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 18), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 12), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 6), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value), subtask); } - else if (value & ~MASK (21)) + else if (value & ~BIT_MASK (21)) { /* 5 bytes - more than 21 bits, but not more than 26. */ - put_byte ((MASK (5) << 3) | (MASK (6) & value >> 24), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 18), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 12), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 6), subtask); - put_byte ((1 << 7) | (MASK (6) & value), subtask); + put_byte ((BIT_MASK (5) << 3) | (BIT_MASK (6) & value >> 24), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 18), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 12), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 6), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value), subtask); } else { /* 4 bytes - more than 16 bits, but not more than 21. */ - put_byte ((MASK (4) << 4) | (MASK (6) & value >> 18), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 12), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 6), subtask); - put_byte ((1 << 7) | (MASK (6) & value), subtask); + put_byte ((BIT_MASK (4) << 4) | (BIT_MASK (6) & value >> 18), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 12), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 6), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value), subtask); } - else if (value & ~MASK (7)) - if (value & ~MASK (11)) + else if (value & ~BIT_MASK (7)) + if (value & ~BIT_MASK (11)) { /* 3 bytes - more than 11 bits, but not more than 16. */ - put_byte ((MASK (3) << 5) | (MASK (6) & value >> 12), subtask); - put_byte ((1 << 7) | (MASK (6) & value >> 6), subtask); - put_byte ((1 << 7) | (MASK (6) & value), subtask); + put_byte ((BIT_MASK (3) << 5) | (BIT_MASK (6) & value >> 12), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value >> 6), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value), subtask); } else { /* 2 bytes - more than 7 bits, but not more than 11. */ - put_byte ((MASK (2) << 6) | (MASK (6) & value >> 6), subtask); - put_byte ((1 << 7) | (MASK (6) & value), subtask); + put_byte ((BIT_MASK (2) << 6) | (BIT_MASK (6) & value >> 6), subtask); + put_byte ((1 << 7) | (BIT_MASK (6) & value), subtask); } else /* 1 byte - not more than 7 bits (that is, ASCII). */ @@ -161,9 +161,9 @@ transform_utf8_ucs4 (RECODE_SUBTASK subtask) /* Process one UTF-8 value. EOF is acceptable on first byte only. */ - if ((character & MASK (4) << 4) == MASK (4) << 4) - if ((character & MASK (6) << 2) == MASK (6) << 2) - if ((character & MASK (7) << 1) == MASK (7) << 1) + if ((character & BIT_MASK (4) << 4) == BIT_MASK (4) << 4) + if ((character & BIT_MASK (6) << 2) == BIT_MASK (6) << 2) + if ((character & BIT_MASK (7) << 1) == BIT_MASK (7) << 1) { /* 7 bytes - more than 31 bits (that is, exactly 32 :-). */ #if HANDLE_32_BITS @@ -184,7 +184,7 @@ transform_utf8_ucs4 (RECODE_SUBTASK subtask) else { /* 6 bytes - more than 26 bits, but not more than 31. */ - value = (MASK (1) & character) << 30; + value = (BIT_MASK (1) & character) << 30; GET_DATA_BYTE_AT (24); GET_DATA_BYTE_AT (18); GET_DATA_BYTE_AT (12); @@ -193,10 +193,10 @@ transform_utf8_ucs4 (RECODE_SUBTASK subtask) put_ucs4 (value, subtask); character = get_byte (subtask); } - else if ((character & MASK (5) << 3) == MASK (5) << 3) + else if ((character & BIT_MASK (5) << 3) == BIT_MASK (5) << 3) { /* 5 bytes - more than 21 bits, but not more than 26. */ - value = (MASK (2) & character) << 24; + value = (BIT_MASK (2) & character) << 24; GET_DATA_BYTE_AT (18); GET_DATA_BYTE_AT (12); GET_DATA_BYTE_AT (6); @@ -207,18 +207,18 @@ transform_utf8_ucs4 (RECODE_SUBTASK subtask) else { /* 4 bytes - more than 16 bits, but not more than 21. */ - value = (MASK (3) & character) << 18; + value = (BIT_MASK (3) & character) << 18; GET_DATA_BYTE_AT (12); GET_DATA_BYTE_AT (6); GET_DATA_BYTE_AT (0); put_ucs4 (value, subtask); character = get_byte (subtask); } - else if ((character & MASK (2) << 6) == MASK (2) << 6) - if ((character & MASK (3) << 5) == MASK (3) << 5) + else if ((character & BIT_MASK (2) << 6) == BIT_MASK (2) << 6) + if ((character & BIT_MASK (3) << 5) == BIT_MASK (3) << 5) { /* 3 bytes - more than 11 bits, but not more than 16. */ - value = (MASK (4) & character) << 12; + value = (BIT_MASK (4) & character) << 12; GET_DATA_BYTE_AT (6); GET_DATA_BYTE_AT (0); put_ucs4 (value, subtask); @@ -227,7 +227,7 @@ transform_utf8_ucs4 (RECODE_SUBTASK subtask) else { /* 2 bytes - more than 7 bits, but not more than 11. */ - value = (MASK (5) & character) << 6; + value = (BIT_MASK (5) & character) << 6; GET_DATA_BYTE_AT (0); put_ucs4 (value, subtask); character = get_byte (subtask); @@ -241,7 +241,7 @@ transform_utf8_ucs4 (RECODE_SUBTASK subtask) else { /* 1 byte - not more than 7 bits (that is, ASCII). */ - put_ucs4 (MASK (8) & character, subtask); + put_ucs4 (BIT_MASK (8) & character, subtask); character = get_byte (subtask); }