Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: courgette/instruction_utils.h

Issue 2854113002: [Courgette] Reduce AssemblyProgram to reduce Courgette-apply RAM floor and disk churn. (Closed)
Patch Set: Update courgette_fuzzer in libfuzzer. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/encoded_program_fuzz_unittest.cc ('k') | courgette/patch_generator_x86_32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/instruction_utils.h
diff --git a/courgette/instruction_utils.h b/courgette/instruction_utils.h
index d7dfe97e46625d24e61cb6fffbd44c68adbea9f2..df12aa6e23979b8aa178c326d3c48e8a1f82ecc1 100644
--- a/courgette/instruction_utils.h
+++ b/courgette/instruction_utils.h
@@ -61,6 +61,20 @@ class InstructionReceptor {
// true on success, and false otherwise.
using InstructionGenerator = base::Callback<CheckBool(InstructionReceptor*)>;
+// A counter that increments via .push_back(), so it can be passed via template
+// to substitute std::vector<T>, to count elements instead of storing them.
+template <typename T>
+class CountingVector {
+ public:
+ CountingVector() {}
+
+ void push_back(const T& /* unused */) { ++size_; }
+ size_t size() const { return size_; }
+
+ private:
+ size_t size_ = 0;
+};
+
} // namespace courgette
#endif // COURGETTE_INSTRUCTION_UTILS_H_
« no previous file with comments | « courgette/encoded_program_fuzz_unittest.cc ('k') | courgette/patch_generator_x86_32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698