From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0068.outbound.protection.outlook.com [104.47.40.68]) by dpdk.org (Postfix) with ESMTP id D099F1B015 for ; Sat, 17 Feb 2018 11:50:08 +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=0UrUmNG+s4ZUImqKx4IP7Hc7Opux1/TgEKDc68XlBvo=; b=EAnve2HOq0eDQxusb24aTMLzROGokzJGYjlylErVcrJf+TjPQGaQ2T587TVvGlN1rJ0Y/lR/xOKnZPU0bpb00vIWecMjvtZxRcgL28DGvT6fenUzF/RM2P+EPh0t1CQRMGtcfC0JSnhxWYjK2IKYV+s2dqY5cIhX+rw9Fc1Vtno= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (111.93.218.67) by BN6PR07MB3459.namprd07.prod.outlook.com (10.161.153.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.506.18; Sat, 17 Feb 2018 10:50:05 +0000 From: Pavan Nikhilesh To: jerin.jacob@caviumnetworks.com, thomas@monjalon.net Cc: dev@dpdk.org, Pavan Nikhilesh Date: Sat, 17 Feb 2018 16:19:34 +0530 Message-Id: <20180217104934.17291-2-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180217104934.17291-1-pbhagavatula@caviumnetworks.com> References: <20180217104934.17291-1-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR0101CA0012.INDPRD01.PROD.OUTLOOK.COM (10.174.220.22) To BN6PR07MB3459.namprd07.prod.outlook.com (10.161.153.22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f1a9a00d-84be-4305-d2c1-08d575f43566 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(2017052603307)(7153060)(7193020); SRVR:BN6PR07MB3459; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3459; 3:lDGh1j3rhR2coHudr9xGeMH4eDOm8FOJBHblIKz9iotixlMw5/b1XTTtwEoX5nr6w+c/NCwV8fwvXLI8lRXHiGfvFgNDodxcrDvS2TbFFlTnkpD8yvABP+WxfvLzbv6bM731noAdUuGicFtrcdA6p0ZDDAYKciPU9dF3uXvyjzCVP23IB5mYr8eGQcoVHJf4zjB1Kn2xre+oqhw4pAT0weCkjaBRyjMvPvOUFiO0K9NFYIHSmtC4pLjjMcTnB6jY; 25:/ZSdCjXhxxjBh44INbVH2gee8WkS5OOztccVxsAJufWDdA0GO9sy1ImmKXNd3sBzayQKP1s0NUCi8D3Bd5UCLbx5HyvRh060E5mJDP/YYV40gCodA/NZf5I+bKas01S8bagMFPhjQM/dyP2FqFnIRiiyyzUbvk2KLM1wH7yfLrbY/O1Ms7/vWcjAmqJDCkfrwyNlv5S6LEnqODAdNRgL5myuHBVK1wv01dqbE+FJVJ3pfum0fWVOSR6w6aDaab1VIQgLp5szQJRHL4cq4j1XWh6FXu90ob2fg1tp6C+v/c58EDjA6fQFjy/rAgZ4uhHEHuUCg1ovh7wivITQS+Ppcg==; 31:4T9EJY9xdJAfj17lifpDR31Kv0UUqQMiZOXjCtZfrgEh9Wa52bNri4HEq40MeEb+T+EGFYAwJtMngwEDrapzZu/oj6mGDiNGIxRcshXJWuKwJKga0+GqBqPEJDAAbpHTJLQavnqkEwvuHlBYQJ5GZvEahVyTRDk64XkMcBdErtJEXWHrnN9I8fIpq/l9ky5NARsOWbaGAwfdD2ZjlJq5g0+eicisRIM26av2QpfnOZA= X-MS-TrafficTypeDiagnostic: BN6PR07MB3459: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3459; 20:uaWQm+b2BvVom6Co+WTypI6z2dK0V5nBoF3mtGkwE1yQaXxKEnkyWYB/dztHuclo6wFCiR8XYSbGgnC+X9ibtThbbidVRmrVtr08fgpeidy6LH0K5u9G9K3VIVXIPv7R+SEKebC/kuhtDc2nk2pK4ESMnTGV/1gmWgw+X/oQ2IN2FcrKTeZ0MdTu14Mqzh5jxex6gMK2gu65nQ/EV/UA4rnqw1xYaHcTw2HDy/zT8ULVYoHOWltFrPthub95nt1lxGf031stsSM58jP3LrSG9xP0Oq/L8JpUBYLvNkt5V+B6PStkhUOmxxAW3csEshbDaQmUZmf4wZ3DtTTTpqj4fhxMKCTCSXx8BPGvvtv6uYfvyxZyP+fcp+K8fisI9mAaV2GvGkOjC3O+wzM8RCtpFrpumwKUcrP+pROYeT25Xi3JdkZqhZNNxapY2sUmtJwpk0x1tanjUS1SHmtZOyWvPQcz/DPVvfinSZDb00Oj64SnE1jTsitBscVSXDHs0YS7bgeB5oe57HvlU3ZT3JfNfW7z/kXqS2DjNB0UT7Xt/FLryHrS69eRJED43JwUs5iYxm05LQryS+OIRcs1joxghQEoglc3aFssImAAVnvKOM4=; 4:CySB2lnbZVgglQsTM9MpMh3MHvLGEzSp7A6iwMnPrA0L0kpDdYOykwe+WRcGxIXcBYGTWilSocOqjdMYpE7nmb9RqoyGW+oxY4Uk5elJfBuDgVwe+r9P/S0JZdz2xQw0ahFgHAaq4mPB3Y66Od5WU3qy1UmcU0Fgbgsu+yoy5Qr3aoyTwzLCYA6UR5w5fqbP8JJ9U3qKrEyPMwsFL1uqbYVAbvmcIvQQhgzzOrj0idHbvr1o7U5OusNeom0pzv7zByo+YEk8RuAn8TwXDqDZYg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(3231101)(944501161)(10201501046)(3002001)(93006095)(6041288)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123558120)(6072148)(201708071742011); SRVR:BN6PR07MB3459; BCL:0; PCL:0; RULEID:; SRVR:BN6PR07MB3459; X-Forefront-PRVS: 058637CA05 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(346002)(376002)(39380400002)(396003)(366004)(39860400002)(199004)(189003)(16526019)(50226002)(72206003)(6506007)(386003)(81166006)(50466002)(48376002)(1857600001)(478600001)(81156014)(8676002)(8936002)(26005)(16586007)(316002)(66066001)(76176011)(51416003)(47776003)(97736004)(52116002)(7736002)(6486002)(5009440100003)(5660300001)(25786009)(4326008)(3846002)(6116002)(1076002)(107886003)(15650500001)(2906002)(105586002)(59450400001)(68736007)(305945005)(6512007)(106356001)(36756003)(53936002)(42882006)(2950100002)(6666003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3459; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; BN6PR07MB3459; 23:zKJtdHh0wQ4YmIKEAEDQic4b9JfpuuKTTUxg0lgQn?= =?us-ascii?Q?gASQC0sI1IQ1xzbPIG7Eegepxf0KMfQJ98CqI/cnWG1dDTs/Z8eBnro3ZtGX?= =?us-ascii?Q?8HV4uNqY8bNoqgbzdziCnWodACv4sei9d0Bdl68Xs3L3Hx1dVwfBu+Kad3P+?= =?us-ascii?Q?qILZka0urNQClhXh+O8GSSDbmHdlyYJ00T5ewU1982trcSxcDV0YC3KBumdV?= =?us-ascii?Q?Y41CRr5HU/QUCnBF6ZDT4qHhPPgyMCsVtVxKGFLoOLF7NCop5ZwSK2S+uNV7?= =?us-ascii?Q?y/ckFPFI8yyDOcQ1xdXmvK7w8m9xXO3Ua6LXRT4wFi5vQpvt8lmjG9TkDiZL?= =?us-ascii?Q?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X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2018 10:50:05.5132 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f1a9a00d-84be-4305-d2c1-08d575f43566 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3459 Subject: [dpdk-dev] [PATCH 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: Sat, 17 Feb 2018 10:50:09 -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..16e6b585a 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 = 0; i <= MAX_NUM; i++) { + if (rte_align32lowpow2(i) != p) + FAIL_ALIGN("rte_align32lowpow2", i, p); + if (rte_is_power_of_2(i)) + p = p ? p << 1 : 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 = 0; j <= MAX_NUM; j++) { + if (rte_align64lowpow2(j) != q) + printf("rte_align64lowpow2() test failed: %lu %lu\n", j, + q); + if (rte_is_power_of_2(j)) + q = q ? q << 1 : 1; + } + for (p = 2; p <= MAX_NUM; p <<= 1) { if (!rte_is_power_of_2(p)) -- 2.16.1