diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-27 21:14:48 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-27 21:14:48 -0700 |
commit | c2e1ff39c106ab026e3feb29c038855b7ed00393 (patch) | |
tree | e0255b5b9aed8645edc4426f2d4972280910e065 /arch/tile/lib/string-endian.h | |
parent | 456d3d42460c1fc20ba0d27442443fcd63aaac35 (diff) | |
parent | b48b2c3e50433ff6f7e46186daa7f986bd960215 (diff) | |
download | linux-c2e1ff39c106ab026e3feb29c038855b7ed00393.tar.gz linux-c2e1ff39c106ab026e3feb29c038855b7ed00393.tar.bz2 linux-c2e1ff39c106ab026e3feb29c038855b7ed00393.zip |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Pull in Linus's tree to get the commits that blew away
ARCH_USES_GETTIMEOFFSET but didn't update Sparc correctly, so
that I can apply Stephen Rothwell's fix for that mis-merge.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/tile/lib/string-endian.h')
-rw-r--r-- | arch/tile/lib/string-endian.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/tile/lib/string-endian.h b/arch/tile/lib/string-endian.h new file mode 100644 index 000000000000..c0eed7ce69c3 --- /dev/null +++ b/arch/tile/lib/string-endian.h @@ -0,0 +1,33 @@ +/* + * Copyright 2011 Tilera Corporation. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for + * more details. + * + * Provide a mask based on the pointer alignment that + * sets up non-zero bytes before the beginning of the string. + * The MASK expression works because shift counts are taken mod 64. + * Also, specify how to count "first" and "last" bits + * when the bits have been read as a word. + */ + +#include <asm/byteorder.h> + +#ifdef __LITTLE_ENDIAN +#define MASK(x) (__insn_shl(1ULL, (x << 3)) - 1) +#define NULMASK(x) ((2ULL << x) - 1) +#define CFZ(x) __insn_ctz(x) +#define REVCZ(x) __insn_clz(x) +#else +#define MASK(x) (__insn_shl(-2LL, ((-x << 3) - 1))) +#define NULMASK(x) (-2LL << (63 - x)) +#define CFZ(x) __insn_clz(x) +#define REVCZ(x) __insn_ctz(x) +#endif |