Last change
on this file since 70 was
67,
checked in by rosiere, 17 years ago
|
Ajout d'un nouveau composant : fifo generic (un port lecture et un port ecriture).
|
File size:
455 bytes
|
Line | |
---|
1 | #ifndef morpheo_Log2 |
---|
2 | #define morpheo_Log2 |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id$ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #include <stdint.h> |
---|
12 | #include <math.h> |
---|
13 | using namespace std; |
---|
14 | |
---|
15 | namespace morpheo { |
---|
16 | |
---|
17 | inline uint32_t log2 (uint32_t value) |
---|
18 | { |
---|
19 | return static_cast<uint32_t>(ceil(::log2(value))); |
---|
20 | } |
---|
21 | |
---|
22 | inline bool is_log2 (uint32_t value) |
---|
23 | { |
---|
24 | return (value == static_cast<uint32_t>((1<<(morpheo::log2(value))))); |
---|
25 | } |
---|
26 | |
---|
27 | }; // end namespace morpheo |
---|
28 | |
---|
29 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.