[1/2] lib/cryptodev: avoid implicit conversion to 64 bit number

Message ID 1732758837-6350-1-git-send-email-andremue@linux.microsoft.com (mailing list archive)
State Accepted
Delegated to: akhil goyal
Headers
Series [1/2] lib/cryptodev: avoid implicit conversion to 64 bit number |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Andre Muezerie Nov. 28, 2024, 1:53 a.m. UTC
MSVC issues the warning below:

../lib/cryptodev/rte_cryptodev.c(623): warning C4334: '<<':
    result of 32-bit shift implicitly converted to 64 bits
    (was 64-bit shift intended?)

The code would be better off by using 64 bit numbers to begin with.
That eliminates the need for a conversion to 64 bits later.

Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
 lib/cryptodev/rte_cryptodev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Akhil Goyal Jan. 8, 2025, 10:28 a.m. UTC | #1
> MSVC issues the warning below:
> 
> ../lib/cryptodev/rte_cryptodev.c(623): warning C4334: '<<':
>     result of 32-bit shift implicitly converted to 64 bits
>     (was 64-bit shift intended?)
> 
> The code would be better off by using 64 bit numbers to begin with.
> That eliminates the need for a conversion to 64 bits later.
> 
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>

1/2 patch Applied to dpdk-next-crypto
2/2 patch will be taken via main tree.

Thanks.
  

Patch

diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 85a4b46ac9..a49b0662f3 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -620,7 +620,7 @@  rte_cryptodev_asym_xform_capability_check_hash(
 {
 	bool ret = false;
 
-	if (capability->hash_algos & (1 << hash))
+	if (capability->hash_algos & RTE_BIT64(hash))
 		ret = true;
 
 	rte_cryptodev_trace_asym_xform_capability_check_hash(