Last change
on this file since 87 was
81,
checked in by rosiere, 16 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
File size:
897 bytes
|
Line | |
---|
1 | #ifndef morpheo_Address |
---|
2 | #define morpheo_Address |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id: Address.h 81 2008-04-15 18:40:01Z rosiere $ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | namespace morpheo { |
---|
12 | |
---|
13 | // get_tag, get_index, get_offset ............... |
---|
14 | template <typename T> |
---|
15 | T get_tag (T value, uint32_t size_tag, uint32_t size_index, uint32_t size_offset) |
---|
16 | { |
---|
17 | const T mask = gen_mask<T>(size_tag ); |
---|
18 | return (value >> (size_index+size_offset)) & mask; |
---|
19 | } |
---|
20 | |
---|
21 | template <typename T> |
---|
22 | T get_index (T value, uint32_t size_tag, uint32_t size_index, uint32_t size_offset) |
---|
23 | { |
---|
24 | const T mask = gen_mask<T>(size_index ); |
---|
25 | return (value >> ( size_offset)) & mask; |
---|
26 | } |
---|
27 | |
---|
28 | template <typename T> |
---|
29 | T get_offset (T value, uint32_t size_tag, uint32_t size_index, uint32_t size_offset) |
---|
30 | { |
---|
31 | const T mask = gen_mask<T>(size_offset); |
---|
32 | return (value ) & mask; |
---|
33 | } |
---|
34 | |
---|
35 | }; // end namespace morpheo |
---|
36 | |
---|
37 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.