From: Mandeep Shetty Date: Thu, 5 Mar 2015 22:35:29 +0000 (-0800) Subject: Removing unneccesary floating point conversions. X-Git-Tag: 0.9.1-alpha1~38^2~125 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2da010ceef43c7d289862d6efaabb042df4e9c4b;p=contrib%2Fiotivity.git Removing unneccesary floating point conversions. Remove casting uint types to float in presence bounds calculation and using division with a single floating point constant instead. Change-Id: I7b1738753ccec3109c698774204d3d92fde7de21 Signed-off-by: Mandeep Shetty Reviewed-on: https://gerrit.iotivity.org/gerrit/443 Tested-by: jenkins-iotivity Reviewed-by: Erich Keane Reviewed-by: Sashi Penta --- diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index fdb4d42..fd7fd82 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -552,10 +552,8 @@ OCStackResult HandlePresenceResponse(const CARemoteEndpoint_t* endPoint, cbNode->presence->TTL = maxAge; for(int index = 0; index < PresenceTimeOutSize; index++) { - lowerBound = GetTime(((float)(PresenceTimeOut[index]) - /(float)100)*(float)cbNode->presence->TTL); - higherBound = GetTime(((float)(PresenceTimeOut[index + 1]) - /(float)100)*(float)cbNode->presence->TTL); + lowerBound = GetTime(PresenceTimeOut[index]/ 100.0f*cbNode->presence->TTL); + higherBound = GetTime(PresenceTimeOut[index + 1]/100.0f*cbNode->presence->TTL); cbNode->presence->timeOut[index] = OCGetRandomRange(lowerBound, higherBound); OC_LOG_V(DEBUG, TAG, "----------------lowerBound timeout %d", lowerBound); OC_LOG_V(DEBUG, TAG, "----------------higherBound timeout %d", higherBound);