diff --git a/DESCRIPTION b/DESCRIPTION index 641364b6..d5bf3c6f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: TreeTools Title: Create, Modify and Analyse Phylogenetic Trees -Version: 2.0.0.9002 +Version: 2.0.0.9003 Authors@R: c( person("Martin R.", 'Smith', role = c("aut", "cre", "cph"), email = "martin.smith@durham.ac.uk", diff --git a/NEWS.md b/NEWS.md index 90ecf194..52d1b115 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# TreeTools 2.0.0.9002 (development) # +# TreeTools 2.0.0.9003 (development) # - Support larger trees in `Consensus()`. Uses 32-bit integers, necessitating downstream changes to TreeDist. diff --git a/inst/include/TreeTools/ClusterTable.h b/inst/include/TreeTools/ClusterTable.h index bd7ec0d6..bbd3f5f8 100644 --- a/inst/include/TreeTools/ClusterTable.h +++ b/inst/include/TreeTools/ClusterTable.h @@ -121,7 +121,7 @@ namespace TreeTools { int32 *internal_label_ptr = nullptr; std::vector leftmost_leaf; std::vector T; - int32* T_ptr = nullptr; + std::size_t T_idx = 0; std::vector visited_nth; std::vector x_rows; // Dynamic bitset that uses stack allocation for small trees, @@ -147,10 +147,8 @@ namespace TreeTools { } inline void ENTER(int32 v, int32 w) noexcept { - *T_ptr = v; - ++T_ptr; - *T_ptr = w; - ++T_ptr; + T[T_idx++] = v; + T[T_idx++] = w; } [[nodiscard]] inline int32 N() noexcept { @@ -164,16 +162,16 @@ namespace TreeTools { inline void TRESET() noexcept { // This procedure prepares T for an enumeration of its entries, // beginning with the first entry. - T_ptr = T.data(); + T_idx = 0; } inline void READT(int32 *v, int32 *w) { - *v = *T_ptr++; - *w = *T_ptr++; + *v = T[T_idx++]; + *w = T[T_idx++]; } inline void NVERTEX(int32 *v, int32 *w) noexcept { - if (T_ptr != T.data() + Tlen) { + if (T_idx != static_cast(Tlen)) { READT(v, w); v_j = *v; } else { @@ -184,7 +182,7 @@ namespace TreeTools { inline void NVERTEX_short(int32 *v, int32 *w) noexcept { // Don't count all-tips or all-ingroup: vertices 0, ROOT, Ingp. - if (T_ptr != T.data() + Tlen_short) { + if (T_idx != static_cast(Tlen_short)) { READT(v, w); // v_j = *v; // Unneeded unless we go on to call LEFTLEAF } else { @@ -214,7 +212,7 @@ namespace TreeTools { // This function procedure returns as its value the internal label // assigned to leaf v // MS note: input = v; output = X[v, 3] - return internal_label_ptr[v]; + return internal_label[v]; } inline int32 DECODE(const int32 internal_relabeling) noexcept { @@ -402,7 +400,7 @@ namespace TreeTools { Tlen = 2 * n_vertex; Tlen_short = Tlen - (2 * 3); T = std::vector(Tlen); - T_ptr = T.data(); + T_idx = 0; resize_uninitialized(leftmost_leaf, n_vertex); resize_uninitialized(visited_nth, n_leaves);