This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
infnan: More elaborate nan parsing for C99-y nan(...)
[perl5.git] / handy.h
diff --git a/handy.h b/handy.h
index f2bd6a8..faa9f7a 100644 (file)
--- a/handy.h
+++ b/handy.h
@@ -1020,6 +1020,7 @@ static const char* const swash_property_names[] = {
 };
 #endif
 
+START_EXTERN_C
 #  ifdef DOINIT
 EXTCONST  U32 PL_charclass[] = {
 #    include "l1_char_class_tab.h"
@@ -1028,6 +1029,7 @@ EXTCONST  U32 PL_charclass[] = {
 #  else /* ! DOINIT */
 EXTCONST U32 PL_charclass[];
 #  endif
+END_EXTERN_C
 
     /* The 1U keeps Solaris from griping when shifting sets the uppermost bit */
 #   define _CC_mask(classnum) (1U << (classnum))
@@ -1719,16 +1721,16 @@ EXTCONST U32 PL_charclass[];
  * The conversion works both ways, so toCTRL('D') is 4, and toCTRL(4) is D,
  * etc. */
 #ifndef EBCDIC
-#  define toCTRL(c)    (__ASSERT_(FITS_IN_8_BITS(c)) toUPPER(c) ^ 64)
+#  define toCTRL(c)    (__ASSERT_(FITS_IN_8_BITS(c)) toUPPER(((U8)(c))) ^ 64)
 #else
-#  define toCTRL(c)   (__ASSERT_(FITS_IN_8_BITS(c))              \
-                      ((isPRINT_A(c))                            \
-                       ? (UNLIKELY((c) == '?')                   \
-                         ? QUESTION_MARK_CTRL                    \
-                         : (NATIVE_TO_LATIN1(toUPPER(c)) ^ 64))  \
-                       : (UNLIKELY((c) == QUESTION_MARK_CTRL)    \
-                         ? '?'                                   \
-                         : (LATIN1_TO_NATIVE((c) ^ 64)))))
+#  define toCTRL(c)   (__ASSERT_(FITS_IN_8_BITS(c))                     \
+                      ((isPRINT_A(c))                                   \
+                       ? (UNLIKELY((c) == '?')                          \
+                         ? QUESTION_MARK_CTRL                           \
+                         : (NATIVE_TO_LATIN1(toUPPER((U8) (c))) ^ 64))  \
+                       : (UNLIKELY((c) == QUESTION_MARK_CTRL)           \
+                         ? '?'                                          \
+                         : (LATIN1_TO_NATIVE(((U8) (c)) ^ 64)))))
 #endif
 
 /* Line numbers are unsigned, 32 bits. */