Skip to content

Commit

Permalink
fix raspberry pi 64 bit division build error (jlam55555#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcyph committed Feb 3, 2021
1 parent bb938f0 commit 4a6bf73
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions veikk_modparms.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* e.g., device-specific module parameters? e.g., ones for gesture pad
*/

#include <linux/math64.h>
#include <linux/moduleparam.h>
#include "veikk.h"

Expand Down Expand Up @@ -338,8 +339,8 @@ void veikk_configure_input_devs(struct veikk_rect ss,
int veikk_map_pressure(s64 pres, s64 pres_max,
struct veikk_pressure_map *coef) {
static const int sf = 100; // constant scale factor of 100 for all coefs
return (s32) (((coef->a3*pres*pres*pres/pres_max/pres_max)
+ (coef->a2*pres*pres/pres_max)
return (s32) div64_s64((div64_s64(div64_s64(coef->a3*pres*pres*pres, pres_max), pres_max)
+ div64_s64(coef->a2*pres*pres, pres_max)
+ (coef->a1*pres)
+ (coef->a0*pres_max))/sf);
}
+ (coef->a0*pres_max)), sf);
}

0 comments on commit 4a6bf73

Please sign in to comment.