From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C91543C21; Thu, 7 Mar 2024 21:54:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9F5F402BA; Thu, 7 Mar 2024 21:53:59 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by mails.dpdk.org (Postfix) with ESMTP id C976C402A3 for ; Thu, 7 Mar 2024 21:53:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709844838; x=1741380838; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=7/XTYLOhNnNCNhMBt6DWjJESW4UteJbgXTvW3SFFB64=; b=TRQf5Sh453iRA5AqZN7jcm3vIg2Y9RSrH7fV2Gp2vr/PXjgXbRLS5XEx B9h9b6up103Z41ihonsthVt0TB9b1Vkkr3vs07W5sOjD4WgB9R2The7AL y9xKfhTmD6bXdewqbczEOBUI9p5GiCi7N7oUM0HkoZ33vW2eNlY99nLjW RV1glnx1q6/kO4po5K8T56cfhHZhlGIMdsbDpNRBhOeaYCcpWinDYDhAj o5Ty4YRjhxryjNqXNvPxrERHrOLXwQMmfx4HLE/JddtpVFjVsD0z7pSTl SxBZqZPHTh9C/+ymTMvYDlmarFph59QNXhdxOu6Lz6p4Gjs6NIsaDMP95 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11006"; a="4420602" X-IronPort-AV: E=Sophos;i="6.07,107,1708416000"; d="scan'208";a="4420602" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2024 12:53:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,107,1708416000"; d="scan'208";a="41215538" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 07 Mar 2024 12:53:56 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 7 Mar 2024 12:53:56 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Thu, 7 Mar 2024 12:53:56 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 7 Mar 2024 12:53:55 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rc6MQvduY9Ndulo6O3Q+BhR8F883zRu+B4/5Kkmmzus+d4SfcLOiskfdXL2FQWCwuF7BzEWPmUUO7b7iT2RmiRxuiMVAxcpchJno9leTrS0/qOjT+lPlxhfwl2ba/cpab4P7SziW/+JsUnfd2wETMCQ7CpEWks9aQHC9tGVClskKEzgC1GM9DWduSfEZgw+ZmwRnhJFyds3msqbpxpcwoZdkrniCA/1NGUGWhd2Nm1zdrBsdQLKOS6SvidqoKLlV/PA6lsVpAttQpEz2wxS9LjT97XchBU+waKv1gmXxzukfQcgveIKf7h3OsYRoCHiy6SsqvmHf1cGrTgfYD7db/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3P00yjL53gVcq1rum77subSAEIIsVVoJXAl/d6fUuhM=; b=VZBRSiKqBdeKXcAgSGwAj8+5aA9uVTuqKbX0sfN/kR+L+riMPLXqhxV1xoWHK4jPjNu6oBHlymnjoa/srlfoi3hA/8qiJ1b/teyH4YICarTm1ZaKC1hTKOzEtvwxEFI0jXJxJmqcn46qRupbe/EVPfypRIvDuAK7v357IAYhoeSC30RJKpzsxhoG1QwarEAOsMAcuyurFJl1rqsvVkXapBMbXrPY5S/uNM/1EYF3nyYFh+3DEjgehC5uBE3upSNCMCb30KFx1OqOY/BTLreEfsTQ5vQN7i0dDLrz65wFDIC4CMYqpHA2gsU1BUQ/uNnU3fnf1IY9wpk75AkpYNmwow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by MN0PR11MB6254.namprd11.prod.outlook.com (2603:10b6:208:3c5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.8; Thu, 7 Mar 2024 20:53:53 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::d10:3009:a8d3:1d2e]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::d10:3009:a8d3:1d2e%7]) with mapi id 15.20.7362.019; Thu, 7 Mar 2024 20:53:53 +0000 Date: Thu, 7 Mar 2024 20:53:49 +0000 From: Bruce Richardson To: Tyler Retzlaff CC: , Dmitry Kozlyuk , Pallavi Kadam Subject: Re: [PATCH v2] eal/windows: resolve conversion and truncation warnings Message-ID: References: <1691009302-32551-1-git-send-email-roretzla@linux.microsoft.com> <1709836482-22576-1-git-send-email-roretzla@linux.microsoft.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1709836482-22576-1-git-send-email-roretzla@linux.microsoft.com> X-ClientProxiedBy: DU2PR04CA0204.eurprd04.prod.outlook.com (2603:10a6:10:28d::29) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|MN0PR11MB6254:EE_ X-MS-Office365-Filtering-Correlation-Id: 3a8720e0-2f59-4d84-fa8d-08dc3ee8b2c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8wUC2LAU2oJpx9t0Dx23NfHTGuFnaPcAK5YK9Q9ICVRbRx17rFJIH9D5cvTyUspL5lSiItVv9nZfq/Z5/o7oWU3PaCGw0A09u3HdeEM0C/QvMLz6s2AHT6J87CRHnHVYoFeU/bWFxuyLjxMHbauqK+XjpVkT68FFWeBJe5dG8YggA7gGrGICjTq6E1etikNpV/xaG9K5dZ8gSI74A9S2wEvc0CfPANIWSisyNAsdwFd8//u4LLHoub4TOSbiOtEijzcQrPMKG16EhBRv2uQAfL3pkS/QcTk24aAr0EtqHlSO9P4EnrjeuRHSx3iQjm/NLO2uhwEfa37BeDz+0lWdF0APQSwtC8P+hZ1chGmo+1+8oRDmyLYUFs7hUjAc5tjHK+/3qpC+O+LDWLHokGn+hxEB8jPwBt9Uq5WVzIoLYj94LMtPejHPQHqBPYOn0TkfyRUQSHEFlaCiyW45TBPxPIl/hDawBI0+GiY7mlanuNY0u1il/t4k0a2vbR/do5mOhu0qh8SEU/R7T2lpKSAiiE5IMM/U1J5bgeP5kvqo47HOvvAti365rwu0IF6mQZKcaJ4UpvF1mwQA0nYqckqCpe20WAdZZxVxJu8603cuICrE6eng+n/dXRRpBmq4VzrDP4ilCDs+Xmgxj+i413cYfvEOtH5/IR+UeElGBl23onA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Ddt65bqkhi/xrw4eoy001Qt60MZvmPsrAgjcCeRmalXxuVXX0+rMXAl0D8IB?= =?us-ascii?Q?YSEM1gnbG1uq6qzX+/xUjlDia1IKJ2An47/R+wTULKRJiRV7SdJSqdOZUF5h?= =?us-ascii?Q?1otFsinmFtjLGM+FtAS3ojwLpleUbd+nPySZD87an5QrCKLfOy0w6qJs+Z8r?= =?us-ascii?Q?AsrUqNHj/Tm2nmYv982sw1HvVcAGv2Wglp48gvtVvqqsMfxLYnMqPZDfIoHg?= =?us-ascii?Q?zKuvdPfMhvlPs4hQtX4q5GgyySJy8Ldb1S3zQUqw2CkGLcAtB8hbEPY7VuoU?= =?us-ascii?Q?dO55tV/jAzFBf+VXzYVy4wgSBHZyk4HLRebi91EYBndtiNTu4+jdc9hU4ANe?= =?us-ascii?Q?9Bhulz4+gxnbOM8wIA6DNVOX38UblOVeO7TyH2ioKHBy2nHT8bJAiMOyLh0t?= =?us-ascii?Q?SSW3KZEuMWYO4dYNJYPsOhJQpUG6LEIs1Fv1p6wCPLFJeMpW0TDH2n/1JmtU?= =?us-ascii?Q?RVuzmZs7eMEUvD2GiuKRF+clzyu/nOD3cGWjiXAYzagsqR5k50pGLrm+v67B?= =?us-ascii?Q?4EjTkrx54CmsF5crCTbAKp6esiNkHP6smJA6V2ngww5ZNfOfj461pLjfBgvZ?= =?us-ascii?Q?0coqsvKWyGOp/EVNlvi/9nC8AxmK5B7lRQ9CV/rcOuDFum0JLG9Db0n76icB?= =?us-ascii?Q?+ArGTdsoM3P/kFuKx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us-ascii?Q?e1ooBfSdqkOvStCdRnpVmzCVUtUqxQxcva7aON9tdNoaF4k0azvxo/eOR6Fp?= =?us-ascii?Q?ZA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 3a8720e0-2f59-4d84-fa8d-08dc3ee8b2c7 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2024 20:53:53.4711 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: poVgtueZjP9xmVJAneSzntMAdqSFuM+WDWJH1JTtvjFmi2c5QEpVFwTNsBsLzeO25SjLPRZ5QJ6ka8IS0Ywhx4vDgMpI3H9v9snS2vWN6aY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR11MB6254 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Mar 07, 2024 at 10:34:42AM -0800, Tyler Retzlaff wrote: > * Initialize const int NS_PER_SEC with an integer literal instead of > double thereby avoiding implicit conversion from double to int. > > * Cast the result of the expression assigned to timespec.tv_nsec to long. > > Signed-off-by: Tyler Retzlaff > Acked-by: Dmitry Kozlyuk > --- > > v2: > * update commit message to correct misspelled timspec -> timespec, > remove remarks about casting to long they were unnecessary. > > lib/eal/windows/include/rte_os_shim.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/eal/windows/include/rte_os_shim.h b/lib/eal/windows/include/rte_os_shim.h > index eda8113..19b12e9 100644 > --- a/lib/eal/windows/include/rte_os_shim.h > +++ b/lib/eal/windows/include/rte_os_shim.h > @@ -87,7 +87,7 @@ > static inline int > rte_clock_gettime(clockid_t clock_id, struct timespec *tp) > { > - const int NS_PER_SEC = 1E9; > + const int NS_PER_SEC = 1000000000; Just for readability, and the immediate visibility of errors, could this be rewritten as (1000 * 1000 * 1000). That avoids us having to count the zeros to know that the number is correct. BTW: is "int" still the best type to use for this value? Would it be better as a #define? /Bruce > LARGE_INTEGER pf, pc; > LONGLONG nsec; > > @@ -102,7 +102,7 @@ > > nsec = pc.QuadPart * NS_PER_SEC / pf.QuadPart; > tp->tv_sec = nsec / NS_PER_SEC; > - tp->tv_nsec = nsec - tp->tv_sec * NS_PER_SEC; > + tp->tv_nsec = (long)(nsec - tp->tv_sec * NS_PER_SEC); > return 0; > default: > return -1; > -- > 1.8.3.1 >