Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.11-rc6 41 lines 997 B view raw
1#ifndef _ASM_WORD_AT_A_TIME_H 2#define _ASM_WORD_AT_A_TIME_H 3 4/* 5 * Word-at-a-time interfaces for PowerPC. 6 */ 7 8#include <linux/kernel.h> 9#include <asm/asm-compat.h> 10 11struct word_at_a_time { 12 const unsigned long high_bits, low_bits; 13}; 14 15#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0xfe) + 1, REPEAT_BYTE(0x7f) } 16 17/* Bit set in the bytes that have a zero */ 18static inline long prep_zero_mask(unsigned long val, unsigned long rhs, const struct word_at_a_time *c) 19{ 20 unsigned long mask = (val & c->low_bits) + c->low_bits; 21 return ~(mask | rhs); 22} 23 24#define create_zero_mask(mask) (mask) 25 26static inline long find_zero(unsigned long mask) 27{ 28 long leading_zero_bits; 29 30 asm (PPC_CNTLZL "%0,%1" : "=r" (leading_zero_bits) : "r" (mask)); 31 return leading_zero_bits >> 3; 32} 33 34static inline bool has_zero(unsigned long val, unsigned long *data, const struct word_at_a_time *c) 35{ 36 unsigned long rhs = val | c->low_bits; 37 *data = rhs; 38 return (val + c->high_bits) & ~rhs; 39} 40 41#endif /* _ASM_WORD_AT_A_TIME_H */