From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0062.outbound.protection.outlook.com [104.47.37.62]) by dpdk.org (Postfix) with ESMTP id 8D5C0A48F for ; Mon, 19 Feb 2018 12:37:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XDc5jxJtIhhECVNo9VmRi3G0Ax8oaru6hZy254vdi+U=; b=cngSNieFarDZkyPEfgIEdTdLk5/FEFuQp2+f+qAejuQr8TL73dcC3DDSEavDvdWP4RSPMSXvhtHkDpuDC+iqPBVwAYof7XZTM/XNvpw3R4chFCHUl8d6tp0MHN4Rwd12OOQjEKfAaqV2yEDJT4CzOkkjEIV80PsCTkM/I8tZXkk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by MWHPR07MB3471.namprd07.prod.outlook.com (10.164.192.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Mon, 19 Feb 2018 11:37:27 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, matan@mellanox.com, keith.wiles@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, Pavan Nikhilesh Date: Mon, 19 Feb 2018 17:06:43 +0530 Message-Id: <20180219113643.10337-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180219113643.10337-1-pbhagavatula@caviumnetworks.com> References: <20180217104934.17291-1-pbhagavatula@caviumnetworks.com> <20180219113643.10337-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: PN1PR01CA0086.INDPRD01.PROD.OUTLOOK.COM (10.174.144.154) To MWHPR07MB3471.namprd07.prod.outlook.com (10.164.192.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 597aa1c9-6f42-47c1-ffce-08d5778d289e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:MWHPR07MB3471; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 3:sTyY5C24gpkaYgEX4CdMvRIlsNewQmEbDgxe/FV5O0SGRaxvYIZAzxZuh8jyyWzo1/REdEqsQggyy32it6Bkj14AJm5HLCyYCkH1/SLIxY2YNJhTALAk9h7S0YfvlfpnKcXkVvDOwoDFRlfJeI04xW/E306TQe429Q0gXZLzSbbUt0BRJt5w86sJw5NgCZL1LwBXTv7WQnAJypI4V6Rjm05g+fnXEvBhpFg90K1mLbF+idENK7e6leP8NAcfqWwg; 25:cDEOsWhfLKj5iKT2laCSD25C/Kxs/Z5cc0TdigB9BusfdaEjbhPp13WlV9Nh1ilDYM7rfe1gSK5pIw7E5QQxPru5TpNtdUwRW//5cHPRvFnYhIgYUPaEQJEeT0ZLfA1aK9ofvomxnQfU+DjSWoEQCA7d4cBKfKOqKb+H3EcsDGahYIwGrmX8WGFwQudT3MFMgyhnNPHI/sZrqtx/EX8DD4Y1cFsDPBJctGbU8nuu47lfjQg5NZbIV+d4BYsr/cYzNLnUdY+/NM42CjUWfNq5OVloOY2u88tgH5uTND2DhKhy0+1i4GX/V6WEyFm+EDNsO5y27slhlXyhT6eyX7PQaw==; 31:dsMwF6sU290R1pBAFAmml6CgL/AzQ5KtIu2lHWqTn5twxU5nHW2hNsOXJ1ZKPvdn/H8xD3Q0fRlymF8ssI+5+oD867j1vjKUsoimmpmrVRonLAaohxiHV1LRhLq3potHOkWbjHgMggPvODzWTTcIvdwtB3q7TELSoVw8Bqz6A+aEcVc3PbuS+lfpKVq+BbeoNlplCiDyBlyGmBhLAQVxjIyKoDT5LVpEpP8p/DbHN0c= X-MS-TrafficTypeDiagnostic: MWHPR07MB3471: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3471; 20:3OqgMgPS/rwl1Vw0M0JAu0J8I383G/vjYwIFnkAutw7DBRaoUDaQgtRTWc64HCCl95vRQa1ezXHEUIAOh83IlgJXbqBAz5HP2Lvfb69d0vhpuq37uAdyoRbLkB7CWyb2+7p17ojr4oAGxFoFZMBrz00iyvsQxcpxwtH5TpLZ/06YHEGIZolQpXCFeWW3UnMEQbFzJ2Z6RUOsZ9Guyrv/PG7+YVDjLlVhRd2m2S9DFLfpL06R6rRvigO9OXcV+BhTxRQSZzeNp6RcNcxzMQKsVSlbgUaNapYOhxHiYQdzyIM+crmMdKYqqobihPtckzbIyITiiabo+T0VRctgg07JSUtcJniSKbMc9umVjhC7ghfQ3dTlo86c86VleVm6HOwz0Cb4ysZ9QrYCxAQkxRKjuhqaSLQ9wpOolevXv0+uzqLAvo5qYYYXIJXpywYQ57IVojLNOrUErXBfA+G3tiFYrWs2rv3EW82fVcsO/FoRR9ga9vQgtUAEtRcpkW10vLIMPSEH4iTygONh98TTSteYakdIWG1u/1J+FSucvvhgeLJx5bYLF73/qlRGntDB2PS3SRcTVzGwW7azUhKHiGebmIoZFOwpqgnZt3G9qAj+peQ=; 4:nUBrk+MVEAs9ShBMWHvqrKV1hi7MGGLdCCNj2xK/NNEGhaekCMyzPH0mV7m8NSv2VlGUH413xwXkIHYbfdyGdTxC/VZNUHc786sR4oOq0iWncF0y+Nbf32b4PqnVhFtilPbmLCR/TmxFVKdnsloHkYpTiBxPt9zAbVYWPqCFUMTv8OHQgwCzkOzQgQ/bCS5k2wyWZZBK4AddtqHUMcg5FIAzcHgVF98XFd7jh63LMcz6B3Yf9GfsGSiDbQKBD9E3JWGl5HKRC633p55bx+Ro2w== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001056)(6040501)(2401047)(8121501046)(5005006)(3231101)(944501161)(93006095)(10201501046)(3002001)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011); SRVR:MWHPR07MB3471; BCL:0; PCL:0; RULEID:; SRVR:MWHPR07MB3471; X-Forefront-PRVS: 0588B2BD96 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(39850400004)(396003)(376002)(39380400002)(366004)(189003)(199004)(105586002)(5009440100003)(106356001)(1076002)(305945005)(7736002)(4326008)(15650500001)(36756003)(97736004)(107886003)(25786009)(81166006)(81156014)(8676002)(50226002)(8936002)(48376002)(68736007)(6486002)(6512007)(53936002)(76176011)(59450400001)(50466002)(16586007)(52116002)(6666003)(42882006)(2950100002)(6506007)(386003)(26005)(5660300001)(3846002)(6116002)(1857600001)(51416003)(316002)(16526019)(478600001)(72206003)(2906002)(47776003)(66066001)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3471; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR07MB3471; 23:ZgSAebuBwLhWLXyEzxxt8u57eaBdvXAp8IV/Cz5iG?= =?us-ascii?Q?s+D2xzyplS23hA/4yU65CPSOg1d7UEC71tCMPKFHJMV5bVEg3eHq8R5eHexG?= =?us-ascii?Q?f0ytenmqLf4HhteaaoJ1V08OHmSb9SuwtuTndhXbFoRmJs7YgZlX3yyJ8JZg?= =?us-ascii?Q?xCGZ5EoeFvmeyqZnRZunsJdhGMftw9MR30pv4EmcRFoVusWcnMMw+D5id+x5?= =?us-ascii?Q?Ygn3N2YppcqLAo6w1TSBMjKEVibwm6Imwkh2j8W6XgAV1p4/rmLqdoJvLDGn?= =?us-ascii?Q?l99gft/r45LvQTu85ccp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L SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2018 11:37:27.4489 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 597aa1c9-6f42-47c1-ffce-08d5778d289e X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3471 Subject: [dpdk-dev] [PATCH v2 2/2] test: update common auto test X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Feb 2018 11:37:32 -0000 Update common auto test to include test for previous power of 2 for both 32 and 64bit integers. Signed-off-by: Pavan Nikhilesh --- test/test/test_common.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/test/test_common.c b/test/test/test_common.c index d0342430f..2115cc78f 100644 --- a/test/test/test_common.c +++ b/test/test/test_common.c @@ -80,6 +80,7 @@ test_align(void) val / pow != (i / pow) + 1) /* if not aligned, hence +1 */ uint32_t i, p, val; + uint64_t j, q; for (i = 1, p = 1; i <= MAX_NUM; i ++) { if (rte_align32pow2(i) != p) @@ -88,6 +89,29 @@ test_align(void) p <<= 1; } + for (i = 1, p = 1; i <= MAX_NUM; i++) { + if (rte_align32prevpow2(i) != p) + FAIL_ALIGN("rte_align32prevpow2", i, p); + if (rte_is_power_of_2(i + 1)) + p = i + 1; + } + + for (j = 1, q = 1; j <= MAX_NUM ; j++) { + if (rte_align64pow2(j) != q) + printf("rte_align64pow2() test failed: %lu %lu\n", j, + q); + if (j == q) + q <<= 1; + } + + for (j = 1, q = 1; j <= MAX_NUM ; j++) { + if (rte_align64prevpow2(j) != q) + printf("rte_align64prevpow2() test failed: %lu %lu\n", + j, q); + if (rte_is_power_of_2(j + 1)) + q = j + 1; + } + for (p = 2; p <= MAX_NUM; p <<= 1) { if (!rte_is_power_of_2(p)) -- 2.16.1