summaryrefslogtreecommitdiff
path: root/numpy/core/src/common
diff options
context:
space:
mode:
authorserge-sans-paille <serge.guelton@telecom-bretagne.eu>2022-01-04 13:53:23 +0100
committerserge-sans-paille <serge.guelton@telecom-bretagne.eu>2022-01-14 22:09:48 +0100
commit73a20fd8ecabfcd0b5c45c1b4ee3adbc03751b10 (patch)
treedbdde666b9ef98a97d71df4751fad690947dbd45 /numpy/core/src/common
parentf40b105d627096ef04ca7a5ccbcd6ff53d810be6 (diff)
downloadnumpy-73a20fd8ecabfcd0b5c45c1b4ee3adbc03751b10.tar.gz
Convert timsort.c.src to C++
Diffstat (limited to 'numpy/core/src/common')
-rw-r--r--numpy/core/src/common/numpy_tag.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/numpy/core/src/common/numpy_tag.h b/numpy/core/src/common/numpy_tag.h
index 60e9b02cd..ee0c36cac 100644
--- a/numpy/core/src/common/numpy_tag.h
+++ b/numpy/core/src/common/numpy_tag.h
@@ -220,6 +220,40 @@ struct timedelta_tag : date_tag {
}
};
+struct string_tag {
+ using type = npy_char;
+ static constexpr NPY_TYPES type_value = NPY_STRING;
+ static int less(type const* a, type const* b, size_t len) {
+ return STRING_LT(a, b, len);
+ }
+ static int less_equal(type const* a, type const* b, size_t len) {
+ return !less(b, a, len);
+ }
+ static void swap(type* a, type* b, size_t len) {
+ STRING_SWAP(a, b, len);
+ }
+ static void copy(type * a, type const* b, size_t len) {
+ STRING_COPY(a, b, len);
+ }
+};
+
+struct unicode_tag {
+ using type = npy_ucs4;
+ static constexpr NPY_TYPES type_value = NPY_UNICODE;
+ static int less(type const* a, type const* b, size_t len) {
+ return UNICODE_LT(a, b, len);
+ }
+ static int less_equal(type const* a, type const* b, size_t len) {
+ return !less(b, a, len);
+ }
+ static void swap(type* a, type* b, size_t len) {
+ UNICODE_SWAP(a, b, len);
+ }
+ static void copy(type * a, type const* b, size_t len) {
+ UNICODE_COPY(a, b, len);
+ }
+};
+
} // namespace npy
#endif