#ifndef _PPC_WORDOPS_H
#define _PPC_WORDOPS_H

#if 0
/* The following is implemented from datasheets.  If you have a
 *  PowerPC and can test the code, send me a note
 *      Alexander Kjeldaas <astor@guardian.no>
 */

extern __inline__ rotr32(__u32 x, int n)
{
	int r;
	if (n == 32 || n == 0 || n == -32)
		return x;
	if (__builtin_const_p(x))
		__asm__("rotrwi %0,%1,%2" : "=r"(r) : "r"(x), "i"(n));
	else
		__asm__("rotrw %0,%1,%2" : "=r"(r) : "r"(x), "r"(n));
	return r;
}

extern __inline__ rotl32(__u32 x, int n)
{
	int r;
	if (n == 32 || n == 0 || n == -32)
		return x;
	if (__builtin_const_p(x))
		__asm__("rotlwi %0,%1,%2" : "=r"(r) : "r"(x), "i"(n));
	else
		__asm__("rotlw %0,%1,%2" : "=r"(r) : "r"(x), "r"(n));
	return r;
}

#else	

#define rotr32(x,n) generic_rotr32(x,n)
#define rotl32(x,n) generic_rotl32(x,n)

#endif

#endif
