Fix clang warning in gguf_check_reserved_keys (#12686)
* Fix clang warning in gguf_check_reserved_keys Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com> * Fix typo Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com> --------- Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com>
This commit is contained in:
parent
2bb3597e42
commit
a6f32f0b34
2 changed files with 3 additions and 2 deletions
|
@ -240,7 +240,7 @@ public:
|
||||||
auto index = key.get<int>();
|
auto index = key.get<int>();
|
||||||
return array_->at(index < 0 ? array_->size() + index : index);
|
return array_->at(index < 0 ? array_->size() + index : index);
|
||||||
} else if (object_) {
|
} else if (object_) {
|
||||||
if (!key.is_hashable()) throw std::runtime_error("Unashable type: " + dump());
|
if (!key.is_hashable()) throw std::runtime_error("Unhashable type: " + dump());
|
||||||
auto it = object_->find(key.primitive_);
|
auto it = object_->find(key.primitive_);
|
||||||
if (it == object_->end()) return Value();
|
if (it == object_->end()) return Value();
|
||||||
return it->second;
|
return it->second;
|
||||||
|
@ -249,7 +249,7 @@ public:
|
||||||
}
|
}
|
||||||
void set(const Value& key, const Value& value) {
|
void set(const Value& key, const Value& value) {
|
||||||
if (!object_) throw std::runtime_error("Value is not an object: " + dump());
|
if (!object_) throw std::runtime_error("Value is not an object: " + dump());
|
||||||
if (!key.is_hashable()) throw std::runtime_error("Unashable type: " + dump());
|
if (!key.is_hashable()) throw std::runtime_error("Unhashable type: " + dump());
|
||||||
(*object_)[key.primitive_] = value;
|
(*object_)[key.primitive_] = value;
|
||||||
}
|
}
|
||||||
Value call(const std::shared_ptr<Context> & context, ArgumentsValue & args) const {
|
Value call(const std::shared_ptr<Context> & context, ArgumentsValue & args) const {
|
||||||
|
|
|
@ -932,6 +932,7 @@ static void gguf_check_reserved_keys(const std::string & key, const T val) {
|
||||||
if constexpr (std::is_same<T, uint32_t>::value) {
|
if constexpr (std::is_same<T, uint32_t>::value) {
|
||||||
GGML_ASSERT(val > 0 && (val & (val - 1)) == 0 && GGUF_KEY_GENERAL_ALIGNMENT " must be power of 2");
|
GGML_ASSERT(val > 0 && (val & (val - 1)) == 0 && GGUF_KEY_GENERAL_ALIGNMENT " must be power of 2");
|
||||||
} else {
|
} else {
|
||||||
|
GGML_UNUSED(val);
|
||||||
GGML_ABORT(GGUF_KEY_GENERAL_ALIGNMENT " must be type u32");
|
GGML_ABORT(GGUF_KEY_GENERAL_ALIGNMENT " must be type u32");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue