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

TOMOYO Linux Cross Reference
Linux/arch/parisc/lib/memset.c

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 /arch/parisc/lib/memset.c (Version linux-6.12-rc7) and /arch/ppc/lib/memset.c (Version linux-5.3.18)


  1 /* SPDX-License-Identifier: GPL-2.0-or-later *      1 
  2 #include <linux/types.h>                          
  3 #include <asm/string.h>                           
  4                                                   
  5 #define OPSIZ (BITS_PER_LONG/8)                   
  6 typedef unsigned long op_t;                       
  7                                                   
  8 void *                                            
  9 memset (void *dstpp, int sc, size_t len)          
 10 {                                                 
 11   unsigned int c = sc;                            
 12   long int dstp = (long int) dstpp;               
 13                                                   
 14   if (len >= 8)                                   
 15     {                                             
 16       size_t xlen;                                
 17       op_t cccc;                                  
 18                                                   
 19       cccc = (unsigned char) c;                   
 20       cccc |= cccc << 8;                          
 21       cccc |= cccc << 16;                         
 22       if (OPSIZ > 4)                              
 23         /* Do the shift in two steps to avoid     
 24         cccc |= (cccc << 16) << 16;               
 25                                                   
 26       /* There are at least some bytes to set.    
 27          No need to test for LEN == 0 in this     
 28       while (dstp % OPSIZ != 0)                   
 29         {                                         
 30           ((unsigned char *) dstp)[0] = c;        
 31           dstp += 1;                              
 32           len -= 1;                               
 33         }                                         
 34                                                   
 35       /* Write 8 `op_t' per iteration until le    
 36       xlen = len / (OPSIZ * 8);                   
 37       while (xlen > 0)                            
 38         {                                         
 39           ((op_t *) dstp)[0] = cccc;              
 40           ((op_t *) dstp)[1] = cccc;              
 41           ((op_t *) dstp)[2] = cccc;              
 42           ((op_t *) dstp)[3] = cccc;              
 43           ((op_t *) dstp)[4] = cccc;              
 44           ((op_t *) dstp)[5] = cccc;              
 45           ((op_t *) dstp)[6] = cccc;              
 46           ((op_t *) dstp)[7] = cccc;              
 47           dstp += 8 * OPSIZ;                      
 48           xlen -= 1;                              
 49         }                                         
 50       len %= OPSIZ * 8;                           
 51                                                   
 52       /* Write 1 `op_t' per iteration until le    
 53       xlen = len / OPSIZ;                         
 54       while (xlen > 0)                            
 55         {                                         
 56           ((op_t *) dstp)[0] = cccc;              
 57           dstp += OPSIZ;                          
 58           xlen -= 1;                              
 59         }                                         
 60       len %= OPSIZ;                               
 61     }                                             
 62                                                   
 63   /* Write the last few bytes.  */                
 64   while (len > 0)                                 
 65     {                                             
 66       ((unsigned char *) dstp)[0] = c;            
 67       dstp += 1;                                  
 68       len -= 1;                                   
 69     }                                             
 70                                                   
 71   return dstpp;                                   
 72 }                                                 
 73                                                   

~ [ 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