Author: brane
Date: Thu Jun 5 00:42:40 2025
New Revision: 1926126
URL: http://svn.apache.org/viewvc?rev=1926126&view=rev
Log:
On the user-defined-authn branch:
* auth/auth.c (find_next_user_scheme_type): Reduce four operations to just
two, for the same result. Compilers optimize it that way -- might as
well make it official. /Obviously/ this is on a critical path where
every cycle counts.
Modified:
serf/branches/user-defined-authn/auth/auth.c
Modified: serf/branches/user-defined-authn/auth/auth.c
URL:
http://svn.apache.org/viewvc/serf/branches/user-defined-authn/auth/auth.c?rev=1926126&r1=1926125&r2=1926126&view=diff
==============================================================================
--- serf/branches/user-defined-authn/auth/auth.c (original)
+++ serf/branches/user-defined-authn/auth/auth.c Thu Jun 5 00:42:40 2025
@@ -614,8 +614,12 @@ static unsigned int find_next_user_schem
const unsigned int avail = user_authn_type_mask & ~user_authn_registered;
/* For the source of this horrible hack, see:
-
https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan*/
- return avail & ~(avail & (avail - 1));
+
https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan
+
+ return avail & ~(avail & (avail - 1));
+
+ Along comes clang and optimizes the above to just two instructions... */
+ return avail & -avail;
}
apr_status_t serf_authn_register_scheme(const char *name,