diff mbox

[odp-lng,2/4] linux-generic: odp_time: reutrn 0 if t2 = t1 instead of MAX for diff

Message ID 1441026351-5378-3-git-send-email-ivan.khoronzhuk@linaro.org
State New
Headers show

Commit Message

Ivan Khoronzhuk Aug. 31, 2015, 1:05 p.m. UTC
It's better to describe by example:

cur = 15;
start = 15;
diff mbox

Patch

diff = 2;
while (odp_time_cycles_diff(start, cur) < diff) {
	cur = odp_time_cycles();
}

This example has to work. It's possible only when t2 - t1 = 0 if t2 = t1.
The validation test on it will be added later.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 platform/linux-generic/odp_time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c
index a08833d..a007d69 100644
--- a/platform/linux-generic/odp_time.c
+++ b/platform/linux-generic/odp_time.c
@@ -14,7 +14,7 @@ 
 
 uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2)
 {
-	if (odp_likely(t2 > t1))
+	if (odp_likely(t2 >= t1))
 		return t2 - t1;
 
 	return t2 + (UINT64_MAX - t1);