diff libinterp/octave-value/ov-ch-mat.cc @ 15452:4d960b078272

build: Remove unnecessary AC_CHECK_FUNCS calls. * configure.ac: Remove unnecessary AC_CHECK_FUNCS calls. Segregate some AC_CHECK_FUNCS calls to only be tested when building GUI. Segregate some AC_CHECK_FUNCS calls to only be tested on certain platforms. * __magick_read__.cc: Shorten comment to less than 80 characters. * ov-ch-mat.cc: Add workaround for toascii if function is not available. * lo-mappers.cc: Use log2f and exp2f if they are available. Otherwise, fall back to double versions log2 and exp2 or other workaround.
author Rik <rik@octave.org>
date Sat, 29 Sep 2012 11:57:44 -0700
parents 2fc554ffbc28
children c9844b82945f
line wrap: on
line diff
--- a/libinterp/octave-value/ov-ch-mat.cc	Fri Sep 28 14:22:54 2012 -0700
+++ b/libinterp/octave-value/ov-ch-mat.cc	Sat Sep 29 11:57:44 2012 -0700
@@ -152,17 +152,23 @@
   return retval;
 }
 
-// The C++ standard guarantees cctype defines functions, not macros (and hence macros *CAN'T*
-// be defined if only cctype is included)
-// so there's no need to f*ck around. The exceptions are isascii and toascii,
-// which are not C++.
+// The C++ standard guarantees cctype defines functions, not macros
+// (and hence macros *CAN'T* be defined if only cctype is included)
+// so there's no need to f*ck around.
+// The exceptions are isascii and toascii, which are not C++.
 // Oddly enough, all those character functions are int (*) (int), even
-// in C++. Wicked!
+// in C++.  Wicked!
 static inline int xisascii (int c)
 { return isascii (c); }
 
 static inline int xtoascii (int c)
-{ return toascii (c); }
+{
+#ifdef HAVE_TOASCII
+  return toascii (c);
+#else
+  return (c & 0x7F);
+#endif
+}
 
 octave_value
 octave_char_matrix::map (unary_mapper_t umap) const