From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0052.outbound.protection.outlook.com [104.47.32.52]) by dpdk.org (Postfix) with ESMTP id 509461C0F6 for ; Wed, 4 Apr 2018 12:16:55 +0200 (CEST) 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=GdHcqcGwzD8qpS4z8pE9u+L6uhZVnhLNT1Ql+jtjd8w=; b=E2S6bh44NznyfCa4BpUz3e0qGHHy+rgVH0DxnMkpZjdHz2pP5l8XYTo2UOhGy4h44VTok7MoNykEawdOyaggGGOWHox6q2QbplZtMDDrVuKo3PGNzlxb5ByiNqjZIkqDuYoP+ghll8FWIHo5uuhkPMcx0+N2YuCsat/fXvqoUJk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from ltp-pvn.caveonetworks.com (111.93.218.67) by CY4PR07MB3462.namprd07.prod.outlook.com (2603:10b6:910:75::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.631.10; Wed, 4 Apr 2018 10:16:52 +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: Wed, 4 Apr 2018 15:46:06 +0530 Message-Id: <20180404101606.5156-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180404101606.5156-1-pbhagavatula@caviumnetworks.com> References: <20180217104934.17291-1-pbhagavatula@caviumnetworks.com> <20180404101606.5156-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: CO2PR04CA0107.namprd04.prod.outlook.com (2603:10b6:104:6::33) To CY4PR07MB3462.namprd07.prod.outlook.com (2603:10b6:910:75::15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 13ffd2b7-aad0-4b9a-637d-08d59a153081 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603328)(7153060)(7193020); SRVR:CY4PR07MB3462; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 3:Q9xKlS0IUpqRM7TlT8L+B9LtFPEnplMaxekKT15TN28JTy70rbn/3tOmIURPXLwdF0d5xYZPVwdW3Z9zsSKgkIgvrTXbf6BytvIFyzHe1kWiWYpFdgNwoEoLj6+Qk9wJ5q1lQhXhsju8TsMUwG4gJVYkzK1PXakw9HXEyFiqsLUbUqbZE+cdBeWU6pM8gKD5R4tEtjfne0kHNmtxneUeUAtqqGVA8SzeLH6wmRI45v68f2Yz4/Ts1OOFU+fer1+c; 25:qWir3YicRy5cwQuKVKnW9k/8ne0QLiMjmzDv0gg4ljBm78Eq3qd4yUpCz4iK3ZpH8Vb+dkRnB80Yi5RKXpxDNysu5sjpdzgq7wKnXmnOnneOyrYmduAO/iaJRzigY8luNrTdJxN1m3Ke6W+q9kSLJCxmfw+9LSRLn8K+fK5QebPR7wvFxjLhIY/hWPNrjNEOamKVbT7bhGGZdjhdvyXxSV/gZpbKHrap/Q5WOy5PY7hV26uXSQLQs9TkGCjduKjD1ZyItPke3fNg1rJsxJbCsbeXz3w4Xx8T+Hm7c2Y2M/ylH/LJe/OaFiMMsrYPuY+MvG/OAYwT6pa8WM07JeU7ng==; 31:52KIDeuAeXfzw7RJW9MaLJrFCiyc1vNFtCLitgFvroq9zLZSyMmYbKuL+jVwa+GRn1PDm5wHG1IVf9sO4TXK9mjna6SumE3JRR8F/RvRQCAR8i5YUn8gDz+xmbSi8dyzbW+KU+bcXT/jKBV1ISZ3DiTPhwpqXRvgLlMc1bTi9El17Iw1KKpC64T2PRexhn/7oma34Hz025guRhMSXqCZC5hFXIBSKApVRllLVeOTm2Q= X-MS-TrafficTypeDiagnostic: CY4PR07MB3462: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 20:u8sdsYrkWsau1Q1fPZD6OU4VxMPsiP1MRAZA9hPbDGcU8l3nWr7TPofNexiJz2ZxEQIZeJO7FVexK4H7/xuHjVj7mTsnzg2MaaN9RgEzZRw0HYjBwYx5XRsGuUi/pcJUpBMwAruZHYO9MZnaA2FupzomqLkshY3Rbdn1Crehza867Wv1FpcKYnLoGx53PD9OmQUewSb9jE4fdx83bTvNCT8bmjwLvjlEd301H/PlnDfVGNxfXjYU8tIG7DtcaVyhitqqHYRVRATwh/aCJqBZJgNRYYlTnjvpuB/UB2V99G0FSF0padDG4sftJo16LCNhXGck5yvydCNcnlKXTNiVohE8NO2HRpf9fqA1OGTxHMXiVlS5Lcj9aGgFnuuPOqYSnk3sHOtS16eRUpXOpy2BP1EpycG4fOWV5u9a0prPulj0U6HfmMfyObAvfjrrKD0i2iplB6DLK+DPwdSZnKxAfCmEvsBJMCWcwFSeFKoiaJqDQJ0mrU8KncQuwytNPQTnOgtZy1wJBjP8UjOMse5pzM7NVSGxeCKB6GmQcRMiBl/UIOv+7i3FzBOliqewKlob2WGzN+TSGEEImldu9TQjE5YPn7MxdxwcHD5VzviYw0M=; 4:igM7i5MoCluYvtwcntRBM5guffo53akl3m6qQKWHoik1FAvT6P1ZadwspGxYrFqm48pQUuiTVu11iNcpxmfMCckUrKQzqqmMi2gWqURLNUzOpCKC59s5G8zpNIXfoEjb3V8gwEL9XEMoLgeqTgyS72e+HqCNoAkE48dy2hZHCI8unaLwEWrixJRIx1voNW1C9mnqIEiCiYfsKWwzeDNL3srizl+l0Xzv/O19BrOvxDq06DxqDmGfhst3QW6Hnb2j8QnwRiPHilvTF+Ac1Fatdw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(3231221)(944501327)(52105095)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:CY4PR07MB3462; BCL:0; PCL:0; RULEID:; SRVR:CY4PR07MB3462; X-Forefront-PRVS: 0632519F33 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(39860400002)(366004)(39380400002)(189003)(199004)(81156014)(76176011)(3846002)(5660300001)(6666003)(1857600001)(2906002)(8936002)(81166006)(16526019)(1076002)(50226002)(25786009)(105586002)(486006)(446003)(6116002)(26005)(106356001)(69596002)(36756003)(386003)(15650500001)(316002)(72206003)(68736007)(476003)(51416003)(6512007)(42882007)(5009440100003)(305945005)(7736002)(6506007)(50466002)(59450400001)(2616005)(52116002)(48376002)(6486002)(66066001)(53416004)(11346002)(47776003)(478600001)(53936002)(8676002)(956004)(97736004)(16586007)(107886003)(4326008)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3462; H:ltp-pvn.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3462; 23:nrxD3I6yuUglt1jbWOiozgDyBt80Hr90kx49JhD84?= =?us-ascii?Q?e9y5Pkkld1n32Ki2PHsvlkJqQ5xu++GxYtnvdE29XzPrLqFdK3nkky1qxS+G?= =?us-ascii?Q?ygyGzUzJe3z12ctwDHoCL5T94k2FiKX0bRL/nbfKwY7YaxOAsCCVUszPTLP8?= =?us-ascii?Q?wibtlkCgsHOL5KMyRiUyZyVbx81ug+Efa+jrZprnGRX67QDmNyNJ5Qan4vOK?= =?us-ascii?Q?KSBLvS6YCgPih2rUo0CcfqelGSNmmQphnOfX0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bqdN+7p6ukrC2//3PW8fcMUShxPVoFDYN2zcNrx/6AUVaYBHN400yjoT9gw8k2ylGRpwcEbH9bbXObzMV90eI6r/OzwftKIh/nMqXR75gnV/BLsAQTYilIoF4KZNmVws=; 24:kptJuvK1F376SxVdAfVQpt5kG+iN5Jx65m4p8oKt3HxNxaZoeN0ccGBTYI+noC7V5iz5QrhK3biJNtDsH0HAToUWjcKbC806Rfy2uBqWRvk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3462; 7:qvVSASCtBYRMo5EW1EWCldca4DePQ7M95w4aesp//TSdVsSCtyT/b0cTAS39Hhavtyb33QlSe8Z2oQTKw7+icTgdBxV1HGA4ipgdorgKuxOK8XD9v9tgf70SzF4LXamlEomwoCh7Fk6cwLkR4qwYaQtLRGED2n+/pVz82tEiw6fFSxt1QnAXc/lQGEzwYHLTHenMZ2nAmpcVV8u/7GgslxASWS9NgDvF8wBid9IvltQItz4GI4vl7eKMc0SewWBx X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Apr 2018 10:16:52.0319 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 13ffd2b7-aad0-4b9a-637d-08d59a153081 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3462 Subject: [dpdk-dev] [PATCH v3 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: Wed, 04 Apr 2018 10:16:55 -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.3