#
#
# patch "ChangeLog"
# from [dd8d02311b1c478bb524ee17742adb3659ebccc2]
# to [00b861d853ea0c04622f51f30bdeb020c845c1eb]
#
# patch "merkle_tree.hh"
# from [1c8305b2f3e3d1e29742113f7f989c61c37487bd]
# to [ac7370ade9ce9d2acce480349671d52061eea41f]
#
============================================================
--- ChangeLog dd8d02311b1c478bb524ee17742adb3659ebccc2
+++ ChangeLog 00b861d853ea0c04622f51f30bdeb020c845c1eb
@@ -1,5 +1,9 @@
2006-04-11 Timothy Brownawell
+ * merkle_tree.hh: make merkle_table be a hash_map instead of a map.
+
+2006-04-11 Timothy Brownawell
+
* commands.cc (ls_branches): Allow "ls branches ".
* tests/t_ls_branches.at: Test it.
============================================================
--- merkle_tree.hh 1c8305b2f3e3d1e29742113f7f989c61c37487bd
+++ merkle_tree.hh ac7370ade9ce9d2acce480349671d52061eea41f
@@ -14,6 +14,8 @@
#include "numeric_vocab.hh"
#include "vocab.hh"
#include "transforms.hh"
+//#include
+#include "hash_map.hh"
// This file contains data structures and functions for managing merkle
// trees. A merkle tree is, conceptually, a general recursive construction
@@ -83,8 +85,48 @@
};
typedef boost::shared_ptr merkle_ptr;
-typedef std::map, merkle_ptr> merkle_table;
+//typedef std::map, merkle_ptr> merkle_table;
+/*
+namespace std {
+ namespace tr1 {
+ template<>
+ struct hash >
+ : public std::unary_function, std::size_t> {
+ hash h;
+ hash t;
+ std::size_t operator()(std::pair const & val) const {
+ return h(val.first()) + t(val.second);
+ }
+ };
+ }
+}
+typedef std::tr1::unordered_map, merkle_ptr> merkle_table;
+*/
+typedef std::pair merkle_node_id;
+namespace hashmap {
+ struct merkle_node_id_hash
+ {
+ string_hash sh;
+ size_t operator()(merkle_node_id const & m) const
+ {
+ return sh(m.first()) + m.second;
+ }
+ };
+}
+struct merkle_node_id_eq
+{
+ bool operator()(merkle_node_id const & a,
+ merkle_node_id const & b) const
+ {
+ return a.second == b.second && a.first == b.first;
+ }
+};
+typedef hashmap::hash_map merkle_table;
+
+
size_t prefix_length_in_bits(size_t level);
size_t prefix_length_in_bytes(size_t level);
void write_node(merkle_node const & in, std::string & outbuf);