From patchwork Fri Sep 11 10:04:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 53433 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f198.google.com (mail-lb0-f198.google.com [209.85.217.198]) by patches.linaro.org (Postfix) with ESMTPS id 9F070215BF for ; Fri, 11 Sep 2015 10:09:21 +0000 (UTC) Received: by lbcjc2 with SMTP id jc2sf22637234lbc.0 for ; Fri, 11 Sep 2015 03:09:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=iVTB1VIZbwynlL+WKzNpOzgGc5rZNcXd8CIlwHWoLVM=; b=E6tvKij8Jl+YDwGElSIUWgtX2W7ZbUHpKDp7H7R/+A0hzSNpY01mpvFrK0IdSCtkm2 f+z7hd3UAKmVa8w4quMs1WM2Ww9JOor9OGM/3jwVZqt5DAiL3ZKRZQjDAEu63TfFyp5q S+ehEk0sMdEo0LQeZ6db2XYpE7cZwMpkOZeq1/OPUpZRwi2UIjSWEbTDYGfrc9w2Yyys NNqobnHb78p5TiFqoSUp7Phvy3d0iiAcXjxVUXvJ1/KkD3q3BRDAKelmC4ATXoMfZ/3c YI9NBEua51Xc0hxm0/yde5tvzPqjsAGVIdSAjq4+RV88LZeXGcitzqVsX6+QLg8snjeq An0g== X-Gm-Message-State: ALoCoQknHfXOz6ae3q3xEEc2I9qEeMn7ebYAL3uSsOeDOvhgTdeKM6fDt8oA1qHheEEoBFYWhtv/ X-Received: by 10.112.149.39 with SMTP id tx7mr11109695lbb.11.1441966160592; Fri, 11 Sep 2015 03:09:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.105 with SMTP id i9ls307709laa.72.gmail; Fri, 11 Sep 2015 03:09:20 -0700 (PDT) X-Received: by 10.152.37.67 with SMTP id w3mr26748145laj.109.1441966160404; Fri, 11 Sep 2015 03:09:20 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id f10si526130lae.88.2015.09.11.03.09.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 03:09:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lbcao8 with SMTP id ao8so36952485lbc.3 for ; Fri, 11 Sep 2015 03:09:20 -0700 (PDT) X-Received: by 10.152.178.165 with SMTP id cz5mr40685199lac.29.1441966160149; Fri, 11 Sep 2015 03:09:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1485751lbq; Fri, 11 Sep 2015 03:09:19 -0700 (PDT) X-Received: by 10.55.18.214 with SMTP id 83mr62480787qks.7.1441966159247; Fri, 11 Sep 2015 03:09:19 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 203si549500qhu.22.2015.09.11.03.09.18; Fri, 11 Sep 2015 03:09:19 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 50DA561963; Fri, 11 Sep 2015 10:09:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5D2B76195F; Fri, 11 Sep 2015 10:08:18 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 10FB361BB8; Fri, 11 Sep 2015 10:08:11 +0000 (UTC) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by lists.linaro.org (Postfix) with ESMTPS id D212F61979 for ; Fri, 11 Sep 2015 10:05:38 +0000 (UTC) Received: by wiclk2 with SMTP id lk2so58318613wic.0 for ; Fri, 11 Sep 2015 03:05:38 -0700 (PDT) X-Received: by 10.194.78.34 with SMTP id y2mr75385294wjw.91.1441965938115; Fri, 11 Sep 2015 03:05:38 -0700 (PDT) Received: from khorivan.synapse.com ([195.238.92.128]) by smtp.gmail.com with ESMTPSA id ww8sm987313wjb.4.2015.09.11.03.05.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Sep 2015 03:05:37 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Fri, 11 Sep 2015 13:04:47 +0300 Message-Id: <1441965889-15727-4-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441965889-15727-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1441965889-15727-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 3/5] linux-generic: odp_time: reutrn 0 if t2 = t1 instead of MAX for diff X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.khoronzhuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 It's better to describe by example: cur = 15; start = 15; 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 --- 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);