- Timestamp:
- Jan 25, 2021, 11:33:33 PM (5 years ago)
- Location:
- GPL/branches/uniaud32-next
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/alsa-kernel/core/oss/pcm_oss.c
r644 r660 30 30 #include <sound/initval.h> 31 31 #include <sound/mixer_oss.h> 32 #ifdef TARGET_OS233 static inline unsigned int ld2(u_int32_t v)34 {35 unsigned r = 0;36 37 if (v >= 0x10000) {38 v >>= 16;39 r += 16;40 }41 if (v >= 0x100) {42 v >>= 8;43 r += 8;44 }45 if (v >= 0x10) {46 v >>= 4;47 r += 4;48 }49 if (v >= 4) {50 v >>= 2;51 r += 2;52 }53 if (v >= 2)54 r++;55 return r;56 }57 #endif58 32 59 33 #define OSS_ALSAEMULVER _SIOR ('M', 249, int) … … 730 704 if (!oss_buffer_size) 731 705 return -EINVAL; 732 #ifndef TARGET_OS2 //fixme733 706 oss_buffer_size = rounddown_pow_of_two(oss_buffer_size); 734 #else735 oss_buffer_size = 1 << ld2(oss_buffer_size);736 #endif737 707 if (atomic_read(&substream->mmap_count)) { 738 708 if (oss_buffer_size > runtime->oss.mmap_bytes) … … 771 741 if (min_period_size) { 772 742 min_period_size *= oss_frame_size; 773 #ifndef TARGET_OS2 //fixme774 743 min_period_size = roundup_pow_of_two(min_period_size); 775 #else776 min_period_size = 1 << (ld2(min_period_size - 1) + 1);777 #endif778 744 if (oss_period_size < min_period_size) 779 745 oss_period_size = min_period_size; … … 784 750 if (max_period_size) { 785 751 max_period_size *= oss_frame_size; 786 #ifndef TARGET_OS2 //fixme787 752 max_period_size = rounddown_pow_of_two(max_period_size); 788 #else789 max_period_size = 1 << ld2(max_period_size);790 #endif791 753 792 754 if (oss_period_size > max_period_size) -
GPL/branches/uniaud32-next/include/linux/bitops.h
r647 r660 193 193 } 194 194 195 static inline unsigned fls_long(unsigned long l) 196 { 197 return fls(l); 198 } 199 195 200 #endif /* _I386_BITOPS_H */ -
GPL/branches/uniaud32-next/include/linux/kernel.h
r647 r660 11 11 #include <stdarg.h> 12 12 //#include <linux/linkage.h> 13 #include <linux/bitops.h> 13 14 #include <linux/gfp.h> 14 15 #include <linux/types.h> 15 #include <linux/ bitops.h>16 #include <linux/log2.h> 16 17 17 18 /* Optimization barrier */ -
GPL/branches/uniaud32-next/include/linux/log2.h
r647 r660 14 14 { 15 15 return (n != 0 && ((n & (n - 1)) == 0)); 16 } 17 18 /** 19 * __roundup_pow_of_two() - round up to nearest power of two 20 * @n: value to round up 21 */ 22 static inline /*__attribute__((const))*/ 23 unsigned long __roundup_pow_of_two(unsigned long n) 24 { 25 return 1UL << fls_long(n - 1); 26 } 27 28 /** 29 * __rounddown_pow_of_two() - round down to nearest power of two 30 * @n: value to round down 31 */ 32 static inline /*__attribute__((const))*/ 33 unsigned long __rounddown_pow_of_two(unsigned long n) 34 { 35 return 1UL << (fls_long(n) - 1); 16 36 } 17 37 … … 62 82 } 63 83 84 /** 85 * roundup_pow_of_two - round the given value up to nearest power of two 86 * @n: parameter 87 * 88 * round the given value up to the nearest power of two 89 * - the result is undefined when n == 0 90 * - this can be used to initialise global variables from constant data 91 */ 92 #define roundup_pow_of_two(n) \ 93 ( \ 94 __roundup_pow_of_two(n) \ 95 ) 96 97 /** 98 * rounddown_pow_of_two - round the given value down to nearest power of two 99 * @n: parameter 100 * 101 * round the given value down to the nearest power of two 102 * - the result is undefined when n == 0 103 * - this can be used to initialise global variables from constant data 104 */ 105 #define rounddown_pow_of_two(n) \ 106 ( \ 107 __rounddown_pow_of_two(n) \ 108 ) 109 64 110 #endif /* _LINUX_LOG2_H */
Note:
See TracChangeset
for help on using the changeset viewer.