cpufunc.h (ff17a6773e4785a8fb78c540de32a208c43162db) | cpufunc.h (6f240e18b576739b3bb941a0d7420b0147cbeb13) |
---|---|
1/*- 2 * Copyright (c) 2003 Peter Wemm. 3 * Copyright (c) 1993 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 49 unchanged lines hidden (view full) --- 58#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) 59 60static __inline void 61breakpoint(void) 62{ 63 __asm __volatile("int $3"); 64} 65 | 1/*- 2 * Copyright (c) 2003 Peter Wemm. 3 * Copyright (c) 1993 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 49 unchanged lines hidden (view full) --- 58#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) 59 60static __inline void 61breakpoint(void) 62{ 63 __asm __volatile("int $3"); 64} 65 |
66static __inline u_int | 66static __inline __pure2 u_int |
67bsfl(u_int mask) 68{ 69 u_int result; 70 71 __asm __volatile("bsfl %1,%0" : "=r" (result) : "rm" (mask)); 72 return (result); 73} 74 | 67bsfl(u_int mask) 68{ 69 u_int result; 70 71 __asm __volatile("bsfl %1,%0" : "=r" (result) : "rm" (mask)); 72 return (result); 73} 74 |
75static __inline u_long | 75static __inline __pure2 u_long |
76bsfq(u_long mask) 77{ 78 u_long result; 79 80 __asm __volatile("bsfq %1,%0" : "=r" (result) : "rm" (mask)); 81 return (result); 82} 83 | 76bsfq(u_long mask) 77{ 78 u_long result; 79 80 __asm __volatile("bsfq %1,%0" : "=r" (result) : "rm" (mask)); 81 return (result); 82} 83 |
84static __inline u_int | 84static __inline __pure2 u_int |
85bsrl(u_int mask) 86{ 87 u_int result; 88 89 __asm __volatile("bsrl %1,%0" : "=r" (result) : "rm" (mask)); 90 return (result); 91} 92 | 85bsrl(u_int mask) 86{ 87 u_int result; 88 89 __asm __volatile("bsrl %1,%0" : "=r" (result) : "rm" (mask)); 90 return (result); 91} 92 |
93static __inline u_long | 93static __inline __pure2 u_long |
94bsrq(u_long mask) 95{ 96 u_long result; 97 98 __asm __volatile("bsrq %1,%0" : "=r" (result) : "rm" (mask)); 99 return (result); 100} 101 --- 48 unchanged lines hidden (view full) --- 150 151#ifdef _KERNEL 152 153#define HAVE_INLINE_FFS 154#define ffs(x) __builtin_ffs(x) 155 156#define HAVE_INLINE_FFSL 157 | 94bsrq(u_long mask) 95{ 96 u_long result; 97 98 __asm __volatile("bsrq %1,%0" : "=r" (result) : "rm" (mask)); 99 return (result); 100} 101 --- 48 unchanged lines hidden (view full) --- 150 151#ifdef _KERNEL 152 153#define HAVE_INLINE_FFS 154#define ffs(x) __builtin_ffs(x) 155 156#define HAVE_INLINE_FFSL 157 |
158static __inline int | 158static __inline __pure2 int |
159ffsl(long mask) 160{ 161 return (mask == 0 ? mask : (int)bsfq((u_long)mask) + 1); 162} 163 164#define HAVE_INLINE_FFSLL 165 | 159ffsl(long mask) 160{ 161 return (mask == 0 ? mask : (int)bsfq((u_long)mask) + 1); 162} 163 164#define HAVE_INLINE_FFSLL 165 |
166static __inline int | 166static __inline __pure2 int |
167ffsll(long long mask) 168{ 169 return (ffsl((long)mask)); 170} 171 172#define HAVE_INLINE_FLS 173 | 167ffsll(long long mask) 168{ 169 return (ffsl((long)mask)); 170} 171 172#define HAVE_INLINE_FLS 173 |
174static __inline int | 174static __inline __pure2 int |
175fls(int mask) 176{ 177 return (mask == 0 ? mask : (int)bsrl((u_int)mask) + 1); 178} 179 180#define HAVE_INLINE_FLSL 181 | 175fls(int mask) 176{ 177 return (mask == 0 ? mask : (int)bsrl((u_int)mask) + 1); 178} 179 180#define HAVE_INLINE_FLSL 181 |
182static __inline int | 182static __inline __pure2 int |
183flsl(long mask) 184{ 185 return (mask == 0 ? mask : (int)bsrq((u_long)mask) + 1); 186} 187 188#define HAVE_INLINE_FLSLL 189 | 183flsl(long mask) 184{ 185 return (mask == 0 ? mask : (int)bsrq((u_long)mask) + 1); 186} 187 188#define HAVE_INLINE_FLSLL 189 |
190static __inline int | 190static __inline __pure2 int |
191flsll(long long mask) 192{ 193 return (flsl((long)mask)); 194} 195 196#endif /* _KERNEL */ 197 198static __inline void --- 681 unchanged lines hidden --- | 191flsll(long long mask) 192{ 193 return (flsl((long)mask)); 194} 195 196#endif /* _KERNEL */ 197 198static __inline void --- 681 unchanged lines hidden --- |