Skip to content

Commit c33be54

Browse files
committed
Apply clang-format to all source files
Run clang-format to ensure code formatting consistency across: - include/ada/common_defs.h: Format macro spacing - include/ada/expected.h: Format consistency - benchmarks/model_bench.cpp: Consolidate output statements These are purely formatting changes with no functional impact.
1 parent ed7c377 commit c33be54

File tree

3 files changed

+47
-63
lines changed

3 files changed

+47
-63
lines changed

benchmarks/model_bench.cpp

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -192,48 +192,27 @@ void print(const stat_numbers &n) {
192192
std::cout << std::setw(15) << (n.href == n.url_string);
193193
}
194194
void print(const std::vector<stat_numbers> numbers) {
195-
std::cout << std::setw(15) << "input_size"
196-
<< ",";
197-
std::cout << std::setw(15) << "best_cycles"
198-
<< ",";
199-
std::cout << std::setw(15) << "mean_cycles"
200-
<< ",";
201-
std::cout << std::setw(15) << "best_instr"
202-
<< ",";
203-
std::cout << std::setw(15) << "mean_instr"
204-
<< ",";
205-
std::cout << std::setw(15) << "is_valid"
206-
<< ",";
207-
std::cout << std::setw(15) << "href_size"
208-
<< ",";
209-
std::cout << std::setw(15) << "hash_size"
210-
<< ",";
211-
std::cout << std::setw(15) << "search_size"
212-
<< ",";
213-
std::cout << std::setw(15) << "path_size"
214-
<< ",";
215-
std::cout << std::setw(15) << "port_size"
216-
<< ",";
217-
std::cout << std::setw(15) << "host_size"
218-
<< ",";
219-
std::cout << std::setw(15) << "credential_size"
220-
<< ",";
221-
std::cout << std::setw(15) << "protocol_type"
222-
<< ",";
223-
std::cout << std::setw(15) << "has_port"
224-
<< ",";
225-
std::cout << std::setw(15) << "has_authority"
226-
<< ",";
227-
std::cout << std::setw(15) << "has_fragment"
228-
<< ",";
229-
std::cout << std::setw(15) << "has_search"
230-
<< ",";
231-
std::cout << std::setw(15) << "non_ascii_bytes"
232-
<< ",";
233-
std::cout << std::setw(15) << "href_non_ascii_bytes"
234-
<< ",";
235-
std::cout << std::setw(15) << "is_ascii"
236-
<< ",";
195+
std::cout << std::setw(15) << "input_size" << ",";
196+
std::cout << std::setw(15) << "best_cycles" << ",";
197+
std::cout << std::setw(15) << "mean_cycles" << ",";
198+
std::cout << std::setw(15) << "best_instr" << ",";
199+
std::cout << std::setw(15) << "mean_instr" << ",";
200+
std::cout << std::setw(15) << "is_valid" << ",";
201+
std::cout << std::setw(15) << "href_size" << ",";
202+
std::cout << std::setw(15) << "hash_size" << ",";
203+
std::cout << std::setw(15) << "search_size" << ",";
204+
std::cout << std::setw(15) << "path_size" << ",";
205+
std::cout << std::setw(15) << "port_size" << ",";
206+
std::cout << std::setw(15) << "host_size" << ",";
207+
std::cout << std::setw(15) << "credential_size" << ",";
208+
std::cout << std::setw(15) << "protocol_type" << ",";
209+
std::cout << std::setw(15) << "has_port" << ",";
210+
std::cout << std::setw(15) << "has_authority" << ",";
211+
std::cout << std::setw(15) << "has_fragment" << ",";
212+
std::cout << std::setw(15) << "has_search" << ",";
213+
std::cout << std::setw(15) << "non_ascii_bytes" << ",";
214+
std::cout << std::setw(15) << "href_non_ascii_bytes" << ",";
215+
std::cout << std::setw(15) << "is_ascii" << ",";
237216
std::cout << std::setw(15) << "input_is_href";
238217

239218
std::cout << std::endl;

include/ada/common_defs.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
#endif
4141

4242
// Align to N-byte boundary
43-
#define ADA_ROUNDUP_N(a, n) (((a) + ((n)-1)) & ~((n)-1))
44-
#define ADA_ROUNDDOWN_N(a, n) ((a) & ~((n)-1))
43+
#define ADA_ROUNDUP_N(a, n) (((a) + ((n) - 1)) & ~((n) - 1))
44+
#define ADA_ROUNDDOWN_N(a, n) ((a) & ~((n) - 1))
4545

46-
#define ADA_ISALIGNED_N(ptr, n) (((uintptr_t)(ptr) & ((n)-1)) == 0)
46+
#define ADA_ISALIGNED_N(ptr, n) (((uintptr_t)(ptr) & ((n) - 1)) == 0)
4747

4848
#if defined(ADA_REGULAR_VISUAL_STUDIO)
4949

@@ -201,12 +201,13 @@ namespace ada {
201201
std::cerr << "FAIL: " << (MESSAGE) << std::endl; \
202202
abort(); \
203203
} while (0);
204-
#define ADA_ASSERT_EQUAL(LHS, RHS, MESSAGE) \
205-
do { \
206-
if ((LHS) != (RHS)) { \
207-
std::cerr << "Mismatch: '" << (LHS) << "' - '" << (RHS) << "'" << std::endl; \
208-
ADA_FAIL(MESSAGE); \
209-
} \
204+
#define ADA_ASSERT_EQUAL(LHS, RHS, MESSAGE) \
205+
do { \
206+
if ((LHS) != (RHS)) { \
207+
std::cerr << "Mismatch: '" << (LHS) << "' - '" << (RHS) << "'" \
208+
<< std::endl; \
209+
ADA_FAIL(MESSAGE); \
210+
} \
210211
} while (0);
211212
#define ADA_ASSERT_TRUE(COND) \
212213
do { \

include/ada/expected.h

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,25 +1359,29 @@ class expected : private detail::expected_move_assign_base<T, E>,
13591359

13601360
#else
13611361
template <class F>
1362-
TL_EXPECTED_11_CONSTEXPR auto and_then(F &&f) & -> decltype(and_then_impl(
1363-
std::declval<expected &>(), std::forward<F>(f))) {
1362+
TL_EXPECTED_11_CONSTEXPR auto and_then(
1363+
F &&f) & -> decltype(and_then_impl(std::declval<expected &>(),
1364+
std::forward<F>(f))) {
13641365
return and_then_impl(*this, std::forward<F>(f));
13651366
}
13661367
template <class F>
1367-
TL_EXPECTED_11_CONSTEXPR auto and_then(F &&f) && -> decltype(and_then_impl(
1368-
std::declval<expected &&>(), std::forward<F>(f))) {
1368+
TL_EXPECTED_11_CONSTEXPR auto and_then(
1369+
F &&f) && -> decltype(and_then_impl(std::declval<expected &&>(),
1370+
std::forward<F>(f))) {
13691371
return and_then_impl(std::move(*this), std::forward<F>(f));
13701372
}
13711373
template <class F>
1372-
constexpr auto and_then(F &&f) const & -> decltype(and_then_impl(
1373-
std::declval<expected const &>(), std::forward<F>(f))) {
1374+
constexpr auto and_then(
1375+
F &&f) const & -> decltype(and_then_impl(std::declval<expected const &>(),
1376+
std::forward<F>(f))) {
13741377
return and_then_impl(*this, std::forward<F>(f));
13751378
}
13761379

13771380
#ifndef TL_EXPECTED_NO_CONSTRR
13781381
template <class F>
1379-
constexpr auto and_then(F &&f) const && -> decltype(and_then_impl(
1380-
std::declval<expected const &&>(), std::forward<F>(f))) {
1382+
constexpr auto and_then(F &&f)
1383+
const && -> decltype(and_then_impl(std::declval<expected const &&>(),
1384+
std::forward<F>(f))) {
13811385
return and_then_impl(std::move(*this), std::forward<F>(f));
13821386
}
13831387
#endif
@@ -2226,8 +2230,8 @@ template <class Exp, class F,
22262230
*std::declval<Exp>())),
22272231
detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr>
22282232

2229-
constexpr auto expected_map_impl(Exp &&exp, F &&f)
2230-
-> ret_t<Exp, detail::decay_t<Ret>> {
2233+
constexpr auto expected_map_impl(Exp &&exp,
2234+
F &&f) -> ret_t<Exp, detail::decay_t<Ret>> {
22312235
using result = ret_t<Exp, detail::decay_t<Ret>>;
22322236

22332237
return exp.has_value() ? result(detail::invoke(std::forward<F>(f),
@@ -2255,8 +2259,8 @@ template <class Exp, class F,
22552259
class Ret = decltype(detail::invoke(std::declval<F>())),
22562260
detail::enable_if_t<!std::is_void<Ret>::value> * = nullptr>
22572261

2258-
constexpr auto expected_map_impl(Exp &&exp, F &&f)
2259-
-> ret_t<Exp, detail::decay_t<Ret>> {
2262+
constexpr auto expected_map_impl(Exp &&exp,
2263+
F &&f) -> ret_t<Exp, detail::decay_t<Ret>> {
22602264
using result = ret_t<Exp, detail::decay_t<Ret>>;
22612265

22622266
return exp.has_value() ? result(detail::invoke(std::forward<F>(f)))

0 commit comments

Comments
 (0)