2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-15 00:34:10 +08:00
linux-next/include/linux/ascii85.h
Andy Shevchenko 070c46505a drm: include only needed headers in ascii85.h
The ascii85.h is user of exactly two headers, i.e.  math.h and types.h.
There is no need to carry on entire kernel.h.

Link: https://lkml.kernel.org/r/20210611185915.44181-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-07-01 11:06:04 -07:00

40 lines
555 B
C

/*
* SPDX-License-Identifier: GPL-2.0
*
* Copyright (c) 2008 Intel Corporation
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*/
#ifndef _ASCII85_H_
#define _ASCII85_H_
#include <linux/math.h>
#include <linux/types.h>
#define ASCII85_BUFSZ 6
static inline long
ascii85_encode_len(long len)
{
return DIV_ROUND_UP(len, 4);
}
static inline const char *
ascii85_encode(u32 in, char *out)
{
int i;
if (in == 0)
return "z";
out[5] = '\0';
for (i = 5; i--; ) {
out[i] = '!' + in % 85;
in /= 85;
}
return out;
}
#endif