llmodel: constify some casts in LLModelWrapper

This commit is contained in:
Juuso Alasuutari 2023-05-21 23:55:43 +03:00 committed by AT
parent f2528e6f62
commit 8d822f9898

View File

@ -84,20 +84,20 @@ bool llmodel_loadModel(llmodel_model model, const char *model_path)
bool llmodel_isModelLoaded(llmodel_model model) bool llmodel_isModelLoaded(llmodel_model model)
{ {
LLModelWrapper *wrapper = reinterpret_cast<LLModelWrapper*>(model); const auto *llm = reinterpret_cast<LLModelWrapper*>(model)->llModel;
return wrapper->llModel->isModelLoaded(); return llm->isModelLoaded();
} }
uint64_t llmodel_get_state_size(llmodel_model model) uint64_t llmodel_get_state_size(llmodel_model model)
{ {
LLModelWrapper *wrapper = reinterpret_cast<LLModelWrapper*>(model); const auto *llm = reinterpret_cast<LLModelWrapper*>(model)->llModel;
return wrapper->llModel->stateSize(); return llm->stateSize();
} }
uint64_t llmodel_save_state_data(llmodel_model model, uint8_t *dest) uint64_t llmodel_save_state_data(llmodel_model model, uint8_t *dest)
{ {
LLModelWrapper *wrapper = reinterpret_cast<LLModelWrapper*>(model); const auto *llm = reinterpret_cast<LLModelWrapper*>(model)->llModel;
return wrapper->llModel->saveState(dest); return llm->saveState(dest);
} }
uint64_t llmodel_restore_state_data(llmodel_model model, const uint8_t *src) uint64_t llmodel_restore_state_data(llmodel_model model, const uint8_t *src)
@ -181,6 +181,6 @@ void llmodel_setThreadCount(llmodel_model model, int32_t n_threads)
int32_t llmodel_threadCount(llmodel_model model) int32_t llmodel_threadCount(llmodel_model model)
{ {
LLModelWrapper *wrapper = reinterpret_cast<LLModelWrapper*>(model); const auto *llm = reinterpret_cast<LLModelWrapper*>(model)->llModel;
return wrapper->llModel->threadCount(); return llm->threadCount();
} }