forked from mirrors/linux
		
	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>
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			555 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			39 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
 |