Skip to content

Commit 46b9ec8

Browse files
Update preprocessor directives according to guidelines
1 parent ca9e638 commit 46b9ec8

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

ggml/src/gguf.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,9 +1147,9 @@ struct gguf_writer {
11471147
buf.push_back(reinterpret_cast<const int8_t *>(&val)[i]);
11481148
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
11491149
buf.push_back(reinterpret_cast<const int8_t *>(&val)[sizeof(val) - i - 1]);
1150-
#else
1150+
#else // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
11511151
#error Unexpected or undefined __BYTE_ORDER__
1152-
#endif
1152+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
11531153
}
11541154
}
11551155

@@ -1262,9 +1262,9 @@ struct gguf_writer {
12621262
write(kv.get_val<double>(i));
12631263
}
12641264
} break;
1265-
#else
1265+
#else // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
12661266
#error Unexpected or undefined __BYTE_ORDER__
1267-
#endif
1267+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
12681268
case GGUF_TYPE_BOOL: {
12691269
for (size_t i = 0; i < ne; ++i) {
12701270
write(kv.get_val<bool>(i));
@@ -1320,7 +1320,7 @@ struct gguf_writer {
13201320
if (byteswap != nullptr) {
13211321
byteswap(buf.data() + offset, ggml_nelements(&(info.t)) / ggml_blck_size(info.t.type));
13221322
}
1323-
#endif
1323+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
13241324

13251325
pad(alignment);
13261326
}

src/llama-mmap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,9 @@ void llama_mmap::unmap_fragment(size_t first, size_t last) { pimpl->unmap_fragme
443443
// disable mmap on s390x while it usually loads little-endian models
444444
#if (defined(_POSIX_MEMLOCK_RANGE) && !defined(__s390x__)) || defined(_WIN32)
445445
const bool llama_mmap::SUPPORTED = true;
446-
#else
446+
#else // (defined(_POSIX_MEMLOCK_RANGE) && !defined(__s390x__)) || defined(_WIN32)
447447
const bool llama_mmap::SUPPORTED = false;
448-
#endif
448+
#endif // (defined(_POSIX_MEMLOCK_RANGE) && !defined(__s390x__)) || defined(_WIN32)
449449

450450
// llama_mlock
451451

src/llama-model-loader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ bool llama_model_loader::load_all_data(
931931
if (byteswap != nullptr) {
932932
byteswap(cur->data, ggml_nelements(cur) / ggml_blck_size(cur->type));
933933
}
934-
#endif
934+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
935935

936936
if (check_tensors) {
937937
validation_result.emplace_back(std::async(std::launch::async, [cur, n_size] {
@@ -967,7 +967,7 @@ bool llama_model_loader::load_all_data(
967967
if (byteswap != nullptr) {
968968
byteswap(read_buf.data(), read_buf.size() / ggml_blck_size(cur->type));
969969
}
970-
#endif
970+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
971971

972972
ggml_backend_tensor_set(cur, read_buf.data(), 0, n_size);
973973
if (check_tensors && !ggml_validate_row_data(cur->type, read_buf.data(), n_size)) {

src/unicode.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ struct unicode_cpt_flags {
5353
is_lowercase = (flags & LOWERCASE) ? 1 : 0;
5454
is_uppercase = (flags & UPPERCASE) ? 1 : 0;
5555
is_nfd = (flags & NFD) ? 1 : 0;
56-
#else
56+
#else // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
5757
#error Unexpected or undefined __BYTE_ORDER__
58-
#endif
58+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
5959
}
6060

6161
inline uint16_t as_uint() const {
@@ -78,9 +78,9 @@ struct unicode_cpt_flags {
7878
;
7979

8080
return result;
81-
#else
81+
#else // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
8282
#error Unexpected or undefined __BYTE_ORDER__
83-
#endif
83+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
8484
}
8585

8686
inline uint16_t category_flag() const {

tests/test-gguf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ static bool handcrafted_check_kv(const gguf_context * gguf_ctx, const unsigned i
561561
}
562562
break;
563563
}
564-
#endif
564+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
565565

566566
if (!std::equal(data8, data8 + arr_n*type_size, data_gguf)) {
567567
ok = false;
@@ -597,7 +597,7 @@ static bool handcrafted_check_kv(const gguf_context * gguf_ctx, const unsigned i
597597
ggml_convert_to_le((uint64_t*)(data8));
598598
break;
599599
}
600-
#endif
600+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
601601

602602
if (!std::equal(data8, data8 + gguf_type_size(type), data_gguf)) {
603603
ok = false;

0 commit comments

Comments
 (0)