summaryrefslogtreecommitdiff
path: root/src/vector-sort.h
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-03-22 21:14:16 -0700
committerGitHub <noreply@github.com>2017-03-22 21:14:16 -0700
commit192fbd023a542f2e6d7a737ac5412e392dd0e45e (patch)
tree7d8e7e84d6a351b175fa6c132493cda3d8be4cd2 /src/vector-sort.h
parentf8c3d6027dd64c7c3c962aa1d4bfc50e6ecc4a8c (diff)
downloadwabt-192fbd023a542f2e6d7a737ac5412e392dd0e45e.tar.gz
wabt-192fbd023a542f2e6d7a737ac5412e392dd0e45e.tar.bz2
wabt-192fbd023a542f2e6d7a737ac5412e392dd0e45e.zip
Replace wabt::*vector with std::vector (#366)
This propagates through a lot of code since std::vector will call constructors and destructors. In particular, this CL adds many default constructors and destructors to previously POD types. Many of them are only there to construct `Var` and `StringSlice` types, so they likely can be removed when those have their own constructors. Since unions members cannot contain constructors or destructors (without additional implementation), this CL changes those members to pointers instead. (Perhaps in a future CL these will be std::variant instead of union, so the members can be value types again.)
Diffstat (limited to 'src/vector-sort.h')
-rw-r--r--src/vector-sort.h48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/vector-sort.h b/src/vector-sort.h
deleted file mode 100644
index 64171363..00000000
--- a/src/vector-sort.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2016 WebAssembly Community Group participants
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef WABT_VECTOR_SORT_H_
-#define WABT_VECTOR_SORT_H_
-
-#include "vector.h"
-
-/*
- * Define algorithm to sort wabt vectors (defined by macro WABT_VECTOR).
- *
- */
-
-#define WABT_DEFINE_VECTOR_SORT(name, type) \
- static void sort_##name##_vector(type##Vector* in_vec, \
- type##Vector* out_vec, \
- void (*swap_fcn)(type * v1, type * v2), \
- int (*lt_fcn)(type * v1, type * v2)) { \
- /* TODO(karlschimpf) Use a faster sort. */ \
- if (in_vec->size == 0) \
- return; \
- for (size_t i = 0; i < in_vec->size; ++i) { \
- append_##name##_value(out_vec, &in_vec->data[i]); \
- if (out_vec->size < 2) \
- continue; \
- for (size_t j = out_vec->size; j >= 2; --j) { \
- type* v1 = &out_vec->data[j - 1]; \
- type* v2 = &out_vec->data[j - 2]; \
- if (lt_fcn(v1, v2)) \
- swap_fcn(v1, v2); \
- } \
- } \
- }
-
-#endif // WABT_VECTOR_SORT_H_