From: Jan Boon Date: Thu, 30 Oct 2025 06:30:58 +0000 (+0800) Subject: llama : use std::abs instead of abs (#16853) X-Git-Tag: upstream/0.0.7011~128 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=d7395115baf395b75a73a17b0b796e746e468da9;p=pkg%2Fggml%2Fsources%2Fllama.cpp llama : use std::abs instead of abs (#16853) --- diff --git a/src/llama-graph.cpp b/src/llama-graph.cpp index 112d195f..f9751b31 100644 --- a/src/llama-graph.cpp +++ b/src/llama-graph.cpp @@ -2035,7 +2035,7 @@ int32_t llama_relative_position_bucket(llama_pos x, llama_pos y, uint64_t n_buck if (bidirectional) { relative_bucket += (relative_position > 0) * n_buckets; - relative_position = abs(relative_position); + relative_position = std::abs(relative_position); } else { relative_position = -std::min(relative_position, 0); } diff --git a/src/llama-quant.cpp b/src/llama-quant.cpp index 6dd40412..a56b2626 100644 --- a/src/llama-quant.cpp +++ b/src/llama-quant.cpp @@ -653,7 +653,7 @@ static void llama_model_quantize_impl(const std::string & fname_inp, const std:: gguf_set_val_f32(ctx_out.get(), o.key, o.val_f64); } else if (o.tag == LLAMA_KV_OVERRIDE_TYPE_INT) { // Setting type to UINT32. See https://github.com/ggml-org/llama.cpp/pull/14182 for context - gguf_set_val_u32(ctx_out.get(), o.key, (uint32_t)abs(o.val_i64)); + gguf_set_val_u32(ctx_out.get(), o.key, (uint32_t)std::abs(o.val_i64)); } else if (o.tag == LLAMA_KV_OVERRIDE_TYPE_BOOL) { gguf_set_val_bool(ctx_out.get(), o.key, o.val_bool); } else if (o.tag == LLAMA_KV_OVERRIDE_TYPE_STR) {