| 44 | } |
| 45 | |
| 46 | unsigned int BitPrecision(unsigned long value) |
| 47 | { |
| 48 | if (!value) |
| 49 | return 0; |
| 50 | |
| 51 | unsigned int l=0, h=8*sizeof(value); |
| 52 | |
| 53 | while (h-l > 1) |
| 54 | { |
| 55 | unsigned int t = (l+h)/2; |
| 56 | if (value >> t) |
| 57 | l = t; |
| 58 | else |
| 59 | h = t; |
| 60 | } |
| 61 | |
| 62 | return h; |
| 63 | } |
| 64 | |
| 65 | unsigned long Crop(unsigned long value, int size) |
| 66 | { |
no outgoing calls
no test coverage detected