summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungjae Cho <y0.cho@samsung.com>2019-09-24 11:43:49 +0900
committerYoungjae Cho <y0.cho@samsung.com>2019-09-24 11:43:49 +0900
commit889a110f73bca0bd4099f395389c674842a3204d (patch)
tree6e8141098c2f7bd44806ddbe8b4e6798f11f330d
parent6d3732762f4b2c2a331bacf4c82c206a2454b32f (diff)
downloaddevice-emulator-889a110f73bca0bd4099f395389c674842a3204d.tar.gz
device-emulator-889a110f73bca0bd4099f395389c674842a3204d.tar.bz2
device-emulator-889a110f73bca0bd4099f395389c674842a3204d.zip
Add float typecasting to prevent the loss of fractional part in division
Change-Id: I596e67df50c253591bc8365e60623b31ca4c51d1 Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
-rw-r--r--src/device_manager_plugin_emul.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/device_manager_plugin_emul.c b/src/device_manager_plugin_emul.c
index ebca0c4..6f0e226 100644
--- a/src/device_manager_plugin_emul.c
+++ b/src/device_manager_plugin_emul.c
@@ -374,7 +374,7 @@ int OEM_sys_get_backlight_brightness(int index, int *value, int power_saving)
devmgr_log("Can't read max_brightness node[%s]", path);
return ret;
}
- pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * max_brightness / MAX_CANDELA_CRITERION) + 0.5);
+ pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * (float)max_brightness / MAX_CANDELA_CRITERION) + 0.5);
if (*value > max_brightness - pwr_saving_offset)
*value = max_brightness;
@@ -409,7 +409,7 @@ static int OEM_sys_set_backlight_brightness(int index, int value, int power_savi
devmgr_log("Can't read max_brightness node[%s]", path);
return ret;
}
- pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * max_brightness / MAX_CANDELA_CRITERION) + 0.5);
+ pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * (float)max_brightness / MAX_CANDELA_CRITERION) + 0.5);
if (value < pwr_saving_offset)
value = 0;