~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/asm-generic/word-at-a-time.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/asm-generic/word-at-a-time.h (Version linux-6.12-rc7) and /include/asm-ppc/word-at-a-time.h (Version linux-4.15.18)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef _ASM_WORD_AT_A_TIME_H                     
  3 #define _ASM_WORD_AT_A_TIME_H                     
  4                                                   
  5 #include <linux/bitops.h>                         
  6 #include <linux/wordpart.h>                       
  7 #include <asm/byteorder.h>                        
  8                                                   
  9 #ifdef __BIG_ENDIAN                               
 10                                                   
 11 struct word_at_a_time {                           
 12         const unsigned long high_bits, low_bit    
 13 };                                                
 14                                                   
 15 #define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE    
 16                                                   
 17 /* Bit set in the bytes that have a zero */       
 18 static inline long prep_zero_mask(unsigned lon    
 19 {                                                 
 20         unsigned long mask = (val & c->low_bit    
 21         return ~(mask | rhs);                     
 22 }                                                 
 23                                                   
 24 #define create_zero_mask(mask) (mask)             
 25                                                   
 26 static inline long find_zero(unsigned long mas    
 27 {                                                 
 28         long byte = 0;                            
 29 #ifdef CONFIG_64BIT                               
 30         if (mask >> 32)                           
 31                 mask >>= 32;                      
 32         else                                      
 33                 byte = 4;                         
 34 #endif                                            
 35         if (mask >> 16)                           
 36                 mask >>= 16;                      
 37         else                                      
 38                 byte += 2;                        
 39         return (mask >> 8) ? byte : byte + 1;     
 40 }                                                 
 41                                                   
 42 static inline unsigned long has_zero(unsigned     
 43 {                                                 
 44         unsigned long rhs = val | c->low_bits;    
 45         *data = rhs;                              
 46         return (val + c->high_bits) & ~rhs;       
 47 }                                                 
 48                                                   
 49 #ifndef zero_bytemask                             
 50 #define zero_bytemask(mask) (~1ul << __fls(mas    
 51 #endif                                            
 52                                                   
 53 #else                                             
 54                                                   
 55 /*                                                
 56  * The optimal byte mask counting is probably     
 57  * that is architecture-specific. If you have     
 58  * bit count instruction, that might be better    
 59  * and shift, for example.                        
 60  */                                               
 61 struct word_at_a_time {                           
 62         const unsigned long one_bits, high_bit    
 63 };                                                
 64                                                   
 65 #define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE    
 66                                                   
 67 #ifdef CONFIG_64BIT                               
 68                                                   
 69 /*                                                
 70  * Jan Achrenius on G+: microoptimized version    
 71  * the simpler "(mask & ONEBYTES) * ONEBYTES >    
 72  * that works for the bytemasks without having    
 73  * mask them first.                               
 74  */                                               
 75 static inline long count_masked_bytes(unsigned    
 76 {                                                 
 77         return mask*0x0001020304050608ul >> 56    
 78 }                                                 
 79                                                   
 80 #else   /* 32-bit case */                         
 81                                                   
 82 /* Carl Chatfield / Jan Achrenius G+ version f    
 83 static inline long count_masked_bytes(long mas    
 84 {                                                 
 85         /* (000000 0000ff 00ffff ffffff) -> (     
 86         long a = (0x0ff0001+mask) >> 23;          
 87         /* Fix the 1 for 00 case */               
 88         return a & mask;                          
 89 }                                                 
 90                                                   
 91 #endif                                            
 92                                                   
 93 /* Return nonzero if it has a zero */             
 94 static inline unsigned long has_zero(unsigned     
 95 {                                                 
 96         unsigned long mask = ((a - c->one_bits    
 97         *bits = mask;                             
 98         return mask;                              
 99 }                                                 
100                                                   
101 static inline unsigned long prep_zero_mask(uns    
102 {                                                 
103         return bits;                              
104 }                                                 
105                                                   
106 static inline unsigned long create_zero_mask(u    
107 {                                                 
108         bits = (bits - 1) & ~bits;                
109         return bits >> 7;                         
110 }                                                 
111                                                   
112 /* The mask we created is directly usable as a    
113 #define zero_bytemask(mask) (mask)                
114                                                   
115 static inline unsigned long find_zero(unsigned    
116 {                                                 
117         return count_masked_bytes(mask);          
118 }                                                 
119                                                   
120 #endif /* __BIG_ENDIAN */                         
121                                                   
122 #endif /* _ASM_WORD_AT_A_TIME_H */                
123                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php