Chromium Code Reviews| Index: debugger/rsp/rsp_blob_utils.h |
| =================================================================== |
| --- debugger/rsp/rsp_blob_utils.h (revision 956) |
| +++ debugger/rsp/rsp_blob_utils.h (working copy) |
| @@ -4,6 +4,7 @@ |
| #ifndef DEBUGGER_RSP_RSP_BLOB_UTILS_H_ |
| #define DEBUGGER_RSP_RSP_BLOB_UTILS_H_ |
| +#include <assert.h> |
| #include <deque> |
| #include "debugger/base/debug_blob.h" |
| @@ -42,6 +43,26 @@ |
| return (i > 0); |
| } |
| + /// leading zeroes are ignored |
|
mmortensen
2011/07/21 17:36:44
Please add comments for this funciton with @param
garianov1
2011/07/21 17:50:36
Done.
|
| + template <class T> |
| + debug::Blob& PushIntToBack(T value, debug::Blob* blob) { |
| + assert(NULL != blob); |
| + debug::Blob tmp; |
| + for (size_t i = 0; i < sizeof(value); i++) { |
| + uint8_t x = (value & 0xFF); |
| + tmp.PushFront(debug::Blob::GetHexDigit(x, 0)); |
| + tmp.PushFront(debug::Blob::GetHexDigit(x, 1)); |
| + if (sizeof(value) > 1) |
| + value = value >> 8; |
| + } |
| + tmp.PopMatchingBytesFromFront(debug::Blob().FromString("0")); |
| + if (0 == tmp.size()) |
| + blob->PushBack('0'); |
| + else |
| + blob->Append(tmp); |
| + return *blob; |
| + } |
| + |
| /// removes space characters from front and from back of the blob. |
| /// @param blob blob to perform operation on |
| void RemoveSpacesFromBothEnds(debug::Blob* blob); |