Skip to content

Commit 0b5a58c

Browse files
author
Eric Biggers
committed
lib/crc: crc32: Change crc32() from macro to inline function and remove cast
There's no need for crc32() to be a macro. Make it an inline function instead. Also, remove the cast of the data pointer to 'unsigned char const *', which is no longer necessary now that the type used in the function prototype is 'const void *'. Acked-by: Ard Biesheuvel <ardb@kernel.org> Link: https://lore.kernel.org/r/20250619183414.100082-3-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@kernel.org>
1 parent a98e0d6 commit 0b5a58c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

include/linux/crc32.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
*/
3131
u32 crc32_le(u32 crc, const void *p, size_t len);
3232

33+
/* This is just an alias for crc32_le(). */
34+
static inline u32 crc32(u32 crc, const void *p, size_t len)
35+
{
36+
return crc32_le(crc, p, len);
37+
}
38+
3339
/**
3440
* crc32_be() - Compute most-significant-bit-first IEEE CRC-32
3541
* @crc: Initial CRC value. ~0 (recommended) or 0 for a new CRC computation, or
@@ -90,8 +96,6 @@ u32 crc32_optimizations(void);
9096
static inline u32 crc32_optimizations(void) { return 0; }
9197
#endif
9298

93-
#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
94-
9599
/*
96100
* Helpers for hash table generation of ethernet nics:
97101
*

0 commit comments

Comments
 (0)