diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-04-27 10:16:43 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-05-12 11:21:28 -0400 |
commit | 20432fc541bf0fb8f136f0d4635b264c624ce3eb (patch) | |
tree | 61d10548c2a87c966b5f768985734eb29cd3da6e /src/or/routerlist.h | |
parent | ce854a8d22d5056cc1a47a0d4d4251f93a0c667c (diff) | |
download | tor-20432fc541bf0fb8f136f0d4635b264c624ce3eb.tar.gz tor-20432fc541bf0fb8f136f0d4635b264c624ce3eb.zip |
Refactor out u64_dbl_t
This type saved a tiny amount of allocation, but not enough to be
worth keeping.
(This is in preparation for moving choose_array_element_by_weight)
Diffstat (limited to 'src/or/routerlist.h')
-rw-r--r-- | src/or/routerlist.h | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/or/routerlist.h b/src/or/routerlist.h index bc48c2087c..2166cf5114 100644 --- a/src/or/routerlist.h +++ b/src/or/routerlist.h @@ -217,17 +217,10 @@ int hex_digest_nickname_matches(const char *hexdigest, const char *nickname, int is_named); #ifdef ROUTERLIST_PRIVATE -/** Helper type for choosing routers by bandwidth: contains a union of - * double and uint64_t. Before we call scale_array_elements_to_u64, it holds - * a double; after, it holds a uint64_t. */ -typedef union u64_dbl_t { - uint64_t u64; - double dbl; -} u64_dbl_t; - -STATIC int choose_array_element_by_weight(const u64_dbl_t *entries, +STATIC int choose_array_element_by_weight(const uint64_t *entries, int n_entries); -STATIC void scale_array_elements_to_u64(u64_dbl_t *entries, int n_entries, +STATIC void scale_array_elements_to_u64(uint64_t *entries_out, + const double *entries_in, int n_entries, uint64_t *total_out); STATIC const routerstatus_t *router_pick_directory_server_impl( dirinfo_type_t auth, int flags, |