summaryrefslogtreecommitdiff
path: root/embed.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-07-20 11:57:39 -0600
committerKarl Williamson <khw@cpan.org>2021-07-30 05:41:28 -0600
commit330cd0ce7cbde4175b21369c749c6a3186d2ac77 (patch)
tree499d612a443c881e4504fd595b05a3b6ff4a1cfa /embed.h
parentb5288edf08d3f057f4cb70d49137c0a10da649a4 (diff)
downloadperl-330cd0ce7cbde4175b21369c749c6a3186d2ac77.tar.gz
Create and use 32 and 64 bit msbit_pos() fcns
The existing code to determine the position of the most significant 1 bit in a word is extracted from variant_byte_number(), and generalized to use the deBruijn method previously added that works on any bit in the word, rather than the existing method which looks just at the msb of each byte. The code is 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 'embed.h')
-rw-r--r--embed.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/embed.h b/embed.h
index a2fc31f42f..e32b06076c 100644
--- a/embed.h
+++ b/embed.h
@@ -326,6 +326,7 @@
#define mortal_getenv Perl_mortal_getenv
#define mro_get_linear_isa(a) Perl_mro_get_linear_isa(aTHX_ a)
#define mro_method_changed_in(a) Perl_mro_method_changed_in(aTHX_ a)
+#define msbit_pos32 Perl_msbit_pos32
#define my_atof(a) Perl_my_atof(aTHX_ a)
#define my_atof3(a,b,c) Perl_my_atof3(aTHX_ a,b,c)
#define my_dirfd Perl_my_dirfd
@@ -873,6 +874,7 @@
#endif
#if defined(U64TYPE) /* HAS_QUAD undefined outside of core */
#define lsbit_pos64 Perl_lsbit_pos64
+#define msbit_pos64 Perl_msbit_pos64
#define single_1bit_pos64 Perl_single_1bit_pos64
#endif
#if defined(UNLINK_ALL_VERSIONS)