Skip to content

Commit

Permalink
llama : suppress unary minus operator warning (#8448)
Browse files Browse the repository at this point in the history
This commit updates the _try_copy lambda and moves the unary minus
operator to after the cast to int32_t.

The motivation for this that currently the following warning is
generated on windows:

```console
llama.cpp\src\llama.cpp(21147,30): warning C4146: unary minus operator
applied to unsigned type, result still unsigned
```
  • Loading branch information
danbev authored Jul 12, 2024
1 parent c3ebcfa commit f532262
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21144,7 +21144,7 @@ int32_t llama_token_to_piece(const struct llama_model * model, llama_token token
size--;
}
if (length < (int32_t)size) {
return (int32_t) -size;
return -(int32_t) size;
}
memcpy(buf, token, size);
return (int32_t) size;
Expand Down

0 comments on commit f532262

Please sign in to comment.