Skip to content

Commit 3c22daa

Browse files
Update preprocessor directives according to guidelines
1 parent cfb2cd1 commit 3c22daa

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
@@ -1151,9 +1151,9 @@ struct gguf_writer {
11511151
buf.push_back(reinterpret_cast<const int8_t *>(&val)[i]);
11521152
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
11531153
buf.push_back(reinterpret_cast<const int8_t *>(&val)[sizeof(val) - i - 1]);
1154-
#else
1154+
#else // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
11551155
#error Unexpected or undefined __BYTE_ORDER__
1156-
#endif
1156+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
11571157
}
11581158
}
11591159

@@ -1266,9 +1266,9 @@ struct gguf_writer {
12661266
write(kv.get_val<double>(i));
12671267
}
12681268
} break;
1269-
#else
1269+
#else // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
12701270
#error Unexpected or undefined __BYTE_ORDER__
1271-
#endif
1271+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
12721272
case GGUF_TYPE_BOOL: {
12731273
for (size_t i = 0; i < ne; ++i) {
12741274
write(kv.get_val<bool>(i));
@@ -1324,7 +1324,7 @@ struct gguf_writer {
13241324
if (byteswap != nullptr) {
13251325
byteswap(buf.data() + offset, ggml_nelements(&(info.t)) / ggml_blck_size(info.t.type));
13261326
}
1327-
#endif
1327+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
13281328

13291329
pad(alignment);
13301330
}

src/llama-mmap.cpp

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

451451
// llama_mlock
452452

src/llama-model-loader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ bool llama_model_loader::load_all_data(
10301030
if (byteswap != nullptr) {
10311031
byteswap(cur->data, ggml_nelements(cur) / ggml_blck_size(cur->type));
10321032
}
1033-
#endif
1033+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
10341034

10351035
if (check_tensors) {
10361036
validation_result.emplace_back(std::async(std::launch::async, [cur, n_size] {
@@ -1066,7 +1066,7 @@ bool llama_model_loader::load_all_data(
10661066
if (byteswap != nullptr) {
10671067
byteswap(read_buf.data(), read_buf.size() / ggml_blck_size(cur->type));
10681068
}
1069-
#endif
1069+
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
10701070

10711071
ggml_backend_tensor_set(cur, read_buf.data(), 0, n_size);
10721072
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)