Changeset 41 for trunk/IPs/systemC/processor/Morpheo/Include
- Timestamp:
- Jun 7, 2007, 9:13:47 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Include/ToBase2.h
r2 r41 14 14 namespace morpheo { 15 15 16 inline string toBase2 (uint32_t value, uint32_tsize)16 template<typename T> inline std::string toBase2 (const T& value, const uint32_t & size) 17 17 { 18 18 ostringstream res; 19 uint32_tmask = 1<<(size-1);20 19 T mask = 1<<(size-1); 20 21 21 while (mask != 0) 22 22 { … … 27 27 return res.str(); 28 28 } 29 29 30 inline std::string toBase2 (const bool & value) 31 { 32 return toBase2<bool > (value, 1); 33 } 34 35 inline std::string toBase2 (const uint8_t & value, const uint32_t & size) 36 { 37 return toBase2<uint8_t> (value, size); 38 } 39 40 inline std::string toBase2 (const uint16_t& value, const uint32_t & size) 41 { 42 return toBase2<uint16_t> (value, size); 43 } 44 45 inline std::string toBase2 (const uint32_t& value, const uint32_t & size) 46 { 47 return toBase2<uint32_t> (value, size); 48 } 49 50 inline std::string toBase2 (const uint64_t& value, const uint32_t & size) 51 { 52 return toBase2<uint64_t> (value, size); 53 } 54 55 30 56 }; // end namespace morpheo 31 57
Note: See TracChangeset
for help on using the changeset viewer.