-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate, test and print instruction graph
- Loading branch information
Showing
49 changed files
with
7,116 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
#include <cassert> | ||
#include <cstdlib> | ||
#include <vector> | ||
|
||
namespace celerity::detail { | ||
|
||
/// Like a simple std::unordered_map, but implemented by indexing into a vector with the integral key type. | ||
// TODO I'm taking bikeshedding suggestions for the name. dense_map? integral_map? vector_map? | ||
template <typename KeyId, typename Value> | ||
class dense_map : private std::vector<Value> { | ||
private: | ||
using vector = std::vector<Value>; | ||
|
||
public: | ||
dense_map() = default; | ||
explicit dense_map(const size_t size) : vector(size) {} | ||
|
||
using vector::begin, vector::end, vector::cbegin, vector::cend, vector::empty, vector::size, vector::resize; | ||
|
||
Value& operator[](const KeyId key) { | ||
assert(key < size()); | ||
return vector::operator[](static_cast<size_t>(key)); | ||
} | ||
|
||
const Value& operator[](const KeyId key) const { | ||
assert(key < size()); | ||
return vector::operator[](static_cast<size_t>(key)); | ||
} | ||
}; | ||
|
||
} // namespace celerity::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.