Commit 36120c2
committed
vl53l0x: Cast unsigned abs param to signed type to fix clang warning
FixPoint1616_t is typedef'd to uint32_t. The result of dividing two
variables of that type is also unsigned. Passing an unsigned value to
abs doesn't make sense.
Cast the value to int32_t in case the computaton of diff1_mcps
generates a negative result so that xTalkCorrection doesn't end up
with a huge value.
Signed-off-by: Keith Packard <keithp@keithp.com>1 parent cccbc24 commit 36120c2
2 files changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1872 | 1872 | | |
1873 | 1873 | | |
1874 | 1874 | | |
1875 | | - | |
| 1875 | + | |
1876 | 1876 | | |
1877 | 1877 | | |
1878 | 1878 | | |
| |||
0 commit comments