mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 14:23:49 +01:00
packing() is now used in some hot paths, and it would be good to get rid of some ifs and buts that depend on "op", to speed things up a little bit. With the main implementations now taking size_t endbit, we no longer have to check for negative values. Update the local integer variables to also be size_t to match. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Link: https://patch.msgid.link/20241002-packing-kunit-tests-and-split-pack-unpack-v2-5-8373e551eae3@intel.com Signed-off-by: Jakub Kicinski <[email protected]>
30 lines
708 B
C
30 lines
708 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright 2016-2018 NXP
|
|
* Copyright (c) 2018-2019, Vladimir Oltean <[email protected]>
|
|
*/
|
|
#ifndef _LINUX_PACKING_H
|
|
#define _LINUX_PACKING_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/bitops.h>
|
|
|
|
#define QUIRK_MSB_ON_THE_RIGHT BIT(0)
|
|
#define QUIRK_LITTLE_ENDIAN BIT(1)
|
|
#define QUIRK_LSW32_IS_FIRST BIT(2)
|
|
|
|
enum packing_op {
|
|
PACK,
|
|
UNPACK,
|
|
};
|
|
|
|
int packing(void *pbuf, u64 *uval, int startbit, int endbit, size_t pbuflen,
|
|
enum packing_op op, u8 quirks);
|
|
|
|
int pack(void *pbuf, u64 uval, size_t startbit, size_t endbit, size_t pbuflen,
|
|
u8 quirks);
|
|
|
|
int unpack(const void *pbuf, u64 *uval, size_t startbit, size_t endbit,
|
|
size_t pbuflen, u8 quirks);
|
|
|
|
#endif
|