2727 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828 */
2929
30+ #include < algorithm>
3031#include < array>
3132#include < cmath>
3233
@@ -116,7 +117,8 @@ try_from(const string_fragment& sf)
116117 if (!scan_res) {
117118 return std::nullopt ;
118119 }
119- return try_from_result<double >{(double ) scan_res->value (), EMPTY_SUFFIX};
120+ return try_from_result<double >{(double ) scan_res->value (),
121+ EMPTY_SUFFIX};
120122 }
121123
122124 if (md[real]) {
@@ -141,8 +143,8 @@ try_from(const string_fragment& sf)
141143 }
142144 // IEC `KiB`/`MiB`/... use 1024-multipliers; the bare
143145 // `KB`/`MB`/... forms use the strict SI 1000-multipliers.
144- const double mult
145- = (start + 1 < unit_range. size () && unit_range[start + 1 ] == ' i' )
146+ const double mult = (start + 1 < unit_range. size ()
147+ && unit_range[start + 1 ] == ' i' )
146148 ? 1024.0
147149 : 1000.0 ;
148150 switch (unit_range[start]) {
@@ -212,8 +214,7 @@ try_from(const string_fragment& sf)
212214 if (md[percent]) {
213215 // Return the ratio (e.g. `42%` → 0.42), matching how
214216 // humanize handles the other unit families.
215- auto scan_res
216- = scn::scan_value<double >(md[percent]->to_string_view ());
217+ auto scan_res = scn::scan_value<double >(md[percent]->to_string_view ());
217218 if (!scan_res) {
218219 return std::nullopt ;
219220 }
@@ -319,8 +320,8 @@ try_from(const string_fragment& sf)
319320 break ;
320321 }
321322 }
322- return try_from_result<double >{retval,
323- matched.sub_range (pos, matched.length ())};
323+ return try_from_result<double >{
324+ retval, matched.sub_range (pos, matched.length ())};
324325 }
325326
326327 if (md[per_second]) {
@@ -347,9 +348,8 @@ try_from(const string_fragment& sf)
347348 start += 1 ;
348349 }
349350 const double mult
350- = (start + 1 < range.size () && range[start + 1 ] == ' i' )
351- ? 1024.0
352- : 1000.0 ;
351+ = (start + 1 < range.size () && range[start + 1 ] == ' i' ) ? 1024.0
352+ : 1000.0 ;
353353 if (start < range.size ()) {
354354 switch (range[start]) {
355355 case ' E' :
@@ -425,7 +425,17 @@ struct scale_result {
425425
426426// Indexed by exponent + 4; exponents run from -4 (pico) to +6 (exa).
427427static constexpr std::array<const char *, 11 > SI_PREFIXES = {
428- " p" , " n" , " u" , " m" , " " , " k" , " M" , " G" , " T" , " P" , " E" ,
428+ " p" ,
429+ " n" ,
430+ " u" ,
431+ " m" ,
432+ " " ,
433+ " k" ,
434+ " M" ,
435+ " G" ,
436+ " T" ,
437+ " P" ,
438+ " E" ,
429439};
430440
431441static const double LN1000 = std::log(1000.0 );
0 commit comments