Last change
on this file since 119 was
88,
checked in by rosiere, 16 years ago
|
Almost complete design
with Test and test platform
|
-
Property svn:keywords set to
Id
|
File size:
438 bytes
|
Line | |
---|
1 | #ifndef Morpheo_Log2_h |
---|
2 | #define Morpheo_Log2_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id: Log2.h 88 2008-12-10 18:31:39Z rosiere $ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #include <stdint.h> |
---|
12 | #include <math.h> |
---|
13 | |
---|
14 | namespace morpheo { |
---|
15 | |
---|
16 | inline uint32_t log2 (uint32_t value) |
---|
17 | { |
---|
18 | return static_cast<uint32_t>(ceil(::log2(value))); |
---|
19 | } |
---|
20 | |
---|
21 | inline bool is_log2 (uint32_t value) |
---|
22 | { |
---|
23 | return (value == static_cast<uint32_t>((1<<(morpheo::log2(value))))); |
---|
24 | } |
---|
25 | |
---|
26 | }; // end namespace morpheo |
---|
27 | |
---|
28 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.