diff options
| author | Heiko Schocher <[email protected]> | 2025-11-18 05:30:37 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-12-04 09:38:58 -0600 |
| commit | 6a0c939b88fd42c6b0a374f7c87317f292df46a1 (patch) | |
| tree | 333d50386eb3b09a8ab118e73ad243beb68d1ebb /include | |
| parent | 69cc92d6869b8ff4591e5b8850872da34934bab9 (diff) | |
lib: Import rol32 function from Linux
sm3 crypto algorithm uses rol32 function from linux, so
import it. Linux base was:
commit ca91b9500108:("Merge tag 'v6.15-rc4-ksmbd-server-fixes' of git://git.samba.org/ksmbd")
Signed-off-by: Heiko Schocher <[email protected]>
Reviewed-by: Ilias Apalodimas <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bitops.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index f826d7f3b34..29e0da48de8 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -148,6 +148,17 @@ static inline unsigned long hweight_long(unsigned long w) return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w); } +/** + * rol32 - rotate a 32-bit value left + * @word: value to rotate + * @shift: bits to roll + */ + +static inline __u32 rol32(__u32 word, unsigned int shift) +{ + return (word << (shift & 31)) | (word >> ((-shift) & 31)); +} + #include <asm/bitops.h> /* linux/include/asm-generic/bitops/non-atomic.h */ |
