summaryrefslogtreecommitdiff
path: root/src/character.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/character.h')
-rw-r--r--src/character.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/character.h b/src/character.h
index ae87b3885d9..cf73083dd04 100644
--- a/src/character.h
+++ b/src/character.h
@@ -68,6 +68,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
? (c) - 0x3FFF00 \
: multibyte_char_to_unibyte (c, Qnil))
+/* Return the raw 8-bit byte for character C,
+ or -1 if C doesn't correspond to a byte. */
+#define CHAR_TO_BYTE_SAFE(c) \
+ (CHAR_BYTE8_P (c) \
+ ? (c) - 0x3FFF00 \
+ : multibyte_char_to_unibyte_safe (c, Qnil))
+
/* Nonzero iff BYTE is the 1st byte of a multibyte form of a character
that corresponds to a raw 8-bit byte. */
#define CHAR_BYTE8_HEAD_P(byte) ((byte) == 0xC0 || (byte) == 0xC1)