<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>New names for the power-of-2 templates (and their header)</title>
</head>

<body>
ISO/IEC JTC1 SC22 WG21 P1182R0<br>
Gennaro Prota &lt;gennaro.prota@gmail.com&gt;<br>
Target audience: LEWG<br>
2018-09-13<br>

<h1>New names for the power-of-2 templates (and their header)</h1>

<h2>Motivation</h2>

This short paper is a request to amend the changes incorporated in the working
paper after the acceptance of P0556: Integral power-of-2 operations, which
proposed adding some template functions, and a new header, for some operations
related to powers of two. Specifically, this asks to change the names of the
facilities and the name of the corresponding header.

At the time of writing, the header name is <code>&lt;bit&gt;</code> and the
facilities have the following names:
<ul>
<li>ispow2</li>
<li>ceil2</li>
<li>floor2</li>
<li>log2p1</li>
</ul>

We believe that these names are too cryptic. Note that names in the C++ library
proper (as opposed to the C library) don't generally use abbreviations.

The issue here is which convention to follow: it can be argued that we already
have std::ceil, std::floor, std::pow; but these names come from C. One can
imagine two policies:

use the new convention (snake case with no abbreviations) on all new names
(which we prefer) or use a convention close to C if the facilities do something
close to some C facility, or involve names already used in C (the policy that
seems to have been used for the facilities discussed here; we don't like this).

It should be discussed, anyway, whether using a literal "2" in the names, in
lieu of the word "two", is OK (spelled out names may become too large: thing
e.g. of "two_hundred_fifty_six"; on the other hand, a "1" may look too similar
to a lowercase ell with some fonts). This paper provisionally proposes the name
<code>&lt;power_of_2&gt;</code> for the header, and the following names for the
templates:
<ul>
<li>is_power_of_2</li>
<li>power_of_2_ceiling</li>
<li>power_of_2_floor</li>
<li>integer_log2_plus_1</li>
</ul>

This paper does not propose any semantic change. It also proposes no changes to
<code>bit_cast</code>.

<h2>References</h2>

<ul>
<li>ISO/IEC JTC1 SC22 WG21 <a href=
"https://wg21.link/p0556R3">P0556R3</a>: "Integral power-of-2
operations" by Jens Maurer</li>
</ul>
</body>
</html>
