summaryrefslogtreecommitdiff
path: root/proto.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-07-20 11:51:59 -0600
committerKarl Williamson <khw@cpan.org>2021-07-30 05:41:28 -0600
commit19d2c525bfed3f9eea1099e6eb745dbb50ca818b (patch)
treea54fc03ca6f4b1fdf8157d9b29b7747e50b0d198 /proto.h
parent58ddb8c5c1121d947ee72818b81ee254edb17699 (diff)
downloadperl-19d2c525bfed3f9eea1099e6eb745dbb50ca818b.tar.gz
Create and use 32 and 64 bit lsbit_pos() fcns
The existing code to determine the position of the least significant 1 bit in a word is extracted from variant_byte_number() and moved to a new function in preparation for being called from other places. A U32 version is created, and on 64 bit platforms, a second, parallel, version taking a U64 argument is also created. This is because future commits may care about the word size differences.
Diffstat (limited to 'proto.h')
-rw-r--r--proto.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/proto.h b/proto.h
index 9b3e207b2a..1ced39d14b 100644
--- a/proto.h
+++ b/proto.h
@@ -1861,6 +1861,12 @@ PERL_CALLCONV I32 Perl_looks_like_number(pTHX_ SV *const sv)
#define PERL_ARGS_ASSERT_LOOKS_LIKE_NUMBER \
assert(sv)
+#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE unsigned Perl_lsbit_pos32(U32 word)
+ __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_LSBIT_POS32
+#endif
+
PERL_CALLCONV int Perl_magic_clear_all_env(pTHX_ SV* sv, MAGIC* mg);
#define PERL_ARGS_ASSERT_MAGIC_CLEAR_ALL_ENV \
assert(sv); assert(mg)
@@ -6712,6 +6718,12 @@ PERL_CALLCONV Signal_t Perl_sighandler(int sig, Siginfo_t *info, void *uap);
#endif
#if defined(U64TYPE) /* HAS_QUAD undefined outside of core */
#ifndef PERL_NO_INLINE_FUNCTIONS
+PERL_STATIC_INLINE unsigned Perl_lsbit_pos64(U64 word)
+ __attribute__warn_unused_result__;
+#define PERL_ARGS_ASSERT_LSBIT_POS64
+#endif
+
+#ifndef PERL_NO_INLINE_FUNCTIONS
PERL_STATIC_INLINE unsigned Perl_single_1bit_pos64(U64 word)
__attribute__warn_unused_result__;
#define PERL_ARGS_ASSERT_SINGLE_1BIT_POS64