Chromium Code Reviews| Index: courgette/image_utils.h |
| diff --git a/courgette/image_utils.h b/courgette/image_utils.h |
| index c016357732d05745c3487a317b1eab98d91fa840..e5186d46fc8baac3d3454be0945dd7e3dceea214 100644 |
| --- a/courgette/image_utils.h |
| +++ b/courgette/image_utils.h |
| @@ -15,6 +15,27 @@ namespace courgette { |
| typedef uint32 RVA; |
| +// A Label is a symbolic reference to an address. Unlike a conventional |
| +// assembly language, we always know the address. The address will later be |
| +// stored in a table and the Label will be replaced with the index into the |
| +// table. |
| +// |
| +// TODO(sra): Make fields private and add setters and getters. |
|
grt (UTC plus 2)
2015/12/03 15:19:09
i think you can remove this TODO. based on https:/
huangs
2015/12/03 19:29:06
I'd rather hold off the "_" suffix change in a mec
grt (UTC plus 2)
2015/12/04 19:33:41
Acknowledged.
|
| +class Label { |
| + public: |
| + enum : int { kNoIndex = -1 }; |
| + explicit Label(RVA rva) : rva_(rva) {} |
| + |
| + bool operator==(const Label& other) const { |
| + return rva_ == other.rva_ && index_ == other.index_ && |
| + count_ == other.count_; |
| + } |
| + |
| + RVA rva_ = 0; // Address referred to by the label. |
| + int index_ = kNoIndex; // Index of address in address table. |
| + int count_ = 0; |
| +}; |
| + |
| // These helper functions avoid the need for casts in the main code. |
| inline uint16 ReadU16(const uint8* address, size_t offset) { |
| return *reinterpret_cast<const uint16*>(address + offset); |