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

TOMOYO Linux Cross Reference
Linux/tools/include/linux/unaligned.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 /tools/include/linux/unaligned.h (Version linux-6.12-rc7) and /tools/include/linux/unaligned.h (Version linux-5.8.18)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef __LINUX_UNALIGNED_H                       
  3 #define __LINUX_UNALIGNED_H                       
  4                                                   
  5 /*                                                
  6  * This is the most generic implementation of     
  7  * and should work almost anywhere.               
  8  */                                               
  9 #pragma GCC diagnostic push                       
 10 #pragma GCC diagnostic ignored "-Wpacked"         
 11 #pragma GCC diagnostic ignored "-Wattributes"     
 12 #include <vdso/unaligned.h>                       
 13                                                   
 14 #define get_unaligned(ptr)      __get_unaligne    
 15 #define put_unaligned(val, ptr) __put_unaligne    
 16                                                   
 17 static inline u16 get_unaligned_le16(const voi    
 18 {                                                 
 19         return le16_to_cpu(__get_unaligned_t(_    
 20 }                                                 
 21                                                   
 22 static inline u32 get_unaligned_le32(const voi    
 23 {                                                 
 24         return le32_to_cpu(__get_unaligned_t(_    
 25 }                                                 
 26                                                   
 27 static inline u64 get_unaligned_le64(const voi    
 28 {                                                 
 29         return le64_to_cpu(__get_unaligned_t(_    
 30 }                                                 
 31                                                   
 32 static inline void put_unaligned_le16(u16 val,    
 33 {                                                 
 34         __put_unaligned_t(__le16, cpu_to_le16(    
 35 }                                                 
 36                                                   
 37 static inline void put_unaligned_le32(u32 val,    
 38 {                                                 
 39         __put_unaligned_t(__le32, cpu_to_le32(    
 40 }                                                 
 41                                                   
 42 static inline void put_unaligned_le64(u64 val,    
 43 {                                                 
 44         __put_unaligned_t(__le64, cpu_to_le64(    
 45 }                                                 
 46                                                   
 47 static inline u16 get_unaligned_be16(const voi    
 48 {                                                 
 49         return be16_to_cpu(__get_unaligned_t(_    
 50 }                                                 
 51                                                   
 52 static inline u32 get_unaligned_be32(const voi    
 53 {                                                 
 54         return be32_to_cpu(__get_unaligned_t(_    
 55 }                                                 
 56                                                   
 57 static inline u64 get_unaligned_be64(const voi    
 58 {                                                 
 59         return be64_to_cpu(__get_unaligned_t(_    
 60 }                                                 
 61                                                   
 62 static inline void put_unaligned_be16(u16 val,    
 63 {                                                 
 64         __put_unaligned_t(__be16, cpu_to_be16(    
 65 }                                                 
 66                                                   
 67 static inline void put_unaligned_be32(u32 val,    
 68 {                                                 
 69         __put_unaligned_t(__be32, cpu_to_be32(    
 70 }                                                 
 71                                                   
 72 static inline void put_unaligned_be64(u64 val,    
 73 {                                                 
 74         __put_unaligned_t(__be64, cpu_to_be64(    
 75 }                                                 
 76                                                   
 77 static inline u32 __get_unaligned_be24(const u    
 78 {                                                 
 79         return p[0] << 16 | p[1] << 8 | p[2];     
 80 }                                                 
 81                                                   
 82 static inline u32 get_unaligned_be24(const voi    
 83 {                                                 
 84         return __get_unaligned_be24(p);           
 85 }                                                 
 86                                                   
 87 static inline u32 __get_unaligned_le24(const u    
 88 {                                                 
 89         return p[0] | p[1] << 8 | p[2] << 16;     
 90 }                                                 
 91                                                   
 92 static inline u32 get_unaligned_le24(const voi    
 93 {                                                 
 94         return __get_unaligned_le24(p);           
 95 }                                                 
 96                                                   
 97 static inline void __put_unaligned_be24(const     
 98 {                                                 
 99         *p++ = (val >> 16) & 0xff;                
100         *p++ = (val >> 8) & 0xff;                 
101         *p++ = val & 0xff;                        
102 }                                                 
103                                                   
104 static inline void put_unaligned_be24(const u3    
105 {                                                 
106         __put_unaligned_be24(val, p);             
107 }                                                 
108                                                   
109 static inline void __put_unaligned_le24(const     
110 {                                                 
111         *p++ = val & 0xff;                        
112         *p++ = (val >> 8) & 0xff;                 
113         *p++ = (val >> 16) & 0xff;                
114 }                                                 
115                                                   
116 static inline void put_unaligned_le24(const u3    
117 {                                                 
118         __put_unaligned_le24(val, p);             
119 }                                                 
120                                                   
121 static inline void __put_unaligned_be48(const     
122 {                                                 
123         *p++ = (val >> 40) & 0xff;                
124         *p++ = (val >> 32) & 0xff;                
125         *p++ = (val >> 24) & 0xff;                
126         *p++ = (val >> 16) & 0xff;                
127         *p++ = (val >> 8) & 0xff;                 
128         *p++ = val & 0xff;                        
129 }                                                 
130                                                   
131 static inline void put_unaligned_be48(const u6    
132 {                                                 
133         __put_unaligned_be48(val, p);             
134 }                                                 
135                                                   
136 static inline u64 __get_unaligned_be48(const u    
137 {                                                 
138         return (u64)p[0] << 40 | (u64)p[1] <<     
139                 p[3] << 16 | p[4] << 8 | p[5];    
140 }                                                 
141                                                   
142 static inline u64 get_unaligned_be48(const voi    
143 {                                                 
144         return __get_unaligned_be48(p);           
145 }                                                 
146 #pragma GCC diagnostic pop                        
147                                                   
148 #endif /* __LINUX_UNALIGNED_H */                  
149                                                   

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