cppcheck divide by zero

This commit is contained in:
Philippe Teuwen 2023-01-15 01:48:45 +01:00
parent 8ac8e3d7d0
commit 3936afcca9

View file

@ -165,6 +165,9 @@ void print_cs(const char *text, pcs s) {
}
static inline uint8_t mod(uint8_t a, uint8_t m) {
if (m==0) {
return 0; // Actually, divide by zero error
}
// Just return the input when this is less or equal than the modular value
if (a < m) return a;