summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2020-11-12 21:58:19 -0700
committerKarl Williamson <khw@cpan.org>2020-11-18 09:50:32 -0700
commit23332c7d6cee0424f6d724f503785a46156f4f87 (patch)
tree8132b7ec736d549acdc1ba3ba457cec5badfb340
parent3dcca105f68f9a3c4474da8390e439dd6bc34a74 (diff)
downloadperl-23332c7d6cee0424f6d724f503785a46156f4f87.tar.gz
Make API some C99 typedef work-arounds
I added these some releases ago, but kept them private. No untoward things have happened, so I'm now making them API.
-rw-r--r--handy.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/handy.h b/handy.h
index 01e4b9678b..7feedcb792 100644
--- a/handy.h
+++ b/handy.h
@@ -284,13 +284,19 @@ typedef U64TYPE U64;
# define U32_MIN PERL_ULONG_MIN
#endif
-/* These C99 typedefs are useful sometimes for, say, loop variables whose
- * maximum values are small, but for which speed trumps size. If we have a C99
- * compiler, use that. Otherwise, a plain 'int' should be good enough.
- *
- * Restrict these to core for now until we are more certain this is a good
- * idea. */
-#if defined(PERL_CORE) || defined(PERL_EXT)
+/*
+=for apidoc_section $integer
+=for apidoc Ay|| PERL_INT_FAST8_T
+=for apidoc_item PERL_INT_FAST16_T
+=for apidoc_item PERL_UINT_FAST8_T
+=for apidoc_item PERL_UINT_FAST16_T
+
+These are equivalent to the correspondingly-named C99 typedefs on platforms
+that have those; they evaluate to C<int> and C<unsigned int> on platforms that
+don't, so that you can portably take advantage of this C99 feature.
+
+=cut
+*/
# ifdef I_STDINT
typedef int_fast8_t PERL_INT_FAST8_T;
typedef uint_fast8_t PERL_UINT_FAST8_T;
@@ -302,7 +308,6 @@ typedef U64TYPE U64;
typedef int PERL_INT_FAST16_T;
typedef unsigned int PERL_UINT_FAST16_T;
# endif
-#endif
/* log(2) (i.e., log base 10 of 2) is pretty close to 0.30103, just in case
* anyone is grepping for it. So BIT_DIGITS gives the number of decimal digits