From 4a6737b0fabb7da84bc218c7d2829284fac7f74f Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 6 Dec 2019 10:37:19 +0000 Subject: [PATCH] Make string optimization (#179) * Add NO_STL std::reverse implementation (#174) Follows the example implementation on [1]. [1] https://en.cppreference.com/w/cpp/algorithm/reverse * Merge remote-tracking branch 'origin/feature/no_stl_unit_tests' into development # Conflicts: # include/etl/stl/alternate/algorithm.h # include/etl/stl/alternate/iterator.h # include/etl/version.h # library.json # library.properties # support/Release notes.txt # test/test_no_stl_algorithm.cpp # test/test_no_stl_iterator.cpp # test/vs2017/etl.vcxproj * Fix merge function duplication * Merge remote-tracking branch 'origin/development' # Conflicts: # include/etl/private/choose_pair_types.h # include/etl/private/choose_tag_types.h # include/etl/version.h # library.json # library.properties # support/Release notes.txt * Update README.md * make_string optimisation. String length is calculated in compile time, no need to use strlen. --- .circleci/config.yml | 26 ++++++++++++++++++++++++++ appveyor.yml | 23 +++++++++++++++++++++++ include/etl/cstring.h | 2 +- include/etl/u16string.h | 2 +- include/etl/u32string.h | 2 +- include/etl/wstring.h | 2 +- 6 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 appveyor.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..28e75cee --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,26 @@ +version: 2 + +jobs: + build: + docker: + - image: "debian:stretch" + steps: + - checkout + - run: + name: Installing SUDO + command: 'apt-get update && apt-get install -y sudo && rm -rf /var/lib/apt/lists/*' + - run: + name: Installing GCC + command: 'apt-get update && apt-get install -y gcc g++' + - run: + name: Install CMAKE + command: 'apt-get update && sudo apt-get install -y cmake' + - run: + name: Creating Build Files + command: 'cmake -H. -Bbuild' + - run: + name: Creating Binary Files + command: 'cmake --build build' + - run: + name: ETL Unit Testing + command: './bin/etl' \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..b4f4dc4c --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,23 @@ +version: 1.0.{build} +branches: + only: + - master +image: Visual Studio 2017 +configuration: +- Debug +- DebugNoSTL +clone_folder: c:\projects\etl +install: +- cmd: git submodule update --init --recursive +before_build: +- cmd: git clone https://github.com/unittest-cpp/unittest-cpp.git c:\projects\unittest-cpp +build: + project: test/vs2017/etl.vcxproj + verbosity: minimal +notifications: +- provider: Webhook + url: https://hooks.slack.com/services/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 + method: POST + on_build_success: true + on_build_failure: true + on_build_status_changed: true \ No newline at end of file diff --git a/include/etl/cstring.h b/include/etl/cstring.h index 6812e2a8..122cdb3b 100644 --- a/include/etl/cstring.h +++ b/include/etl/cstring.h @@ -258,7 +258,7 @@ namespace etl template etl::string make_string(const char (&text) [MAX_SIZE]) { - return etl::string(text); + return etl::string(text, MAX_SIZE - 1); } } diff --git a/include/etl/u16string.h b/include/etl/u16string.h index f52417eb..3dd33aab 100644 --- a/include/etl/u16string.h +++ b/include/etl/u16string.h @@ -258,7 +258,7 @@ namespace etl template etl::u16string make_string(const char16_t (&text) [MAX_SIZE]) { - return etl::u16string(text); + return etl::u16string(text, MAX_SIZE - 1); } } diff --git a/include/etl/u32string.h b/include/etl/u32string.h index 3eec812e..7c01c7a7 100644 --- a/include/etl/u32string.h +++ b/include/etl/u32string.h @@ -258,7 +258,7 @@ namespace etl template etl::u32string make_string(const char32_t (&text) [MAX_SIZE]) { - return etl::u32string(text); + return etl::u32string(text, MAX_SIZE - 1); } } diff --git a/include/etl/wstring.h b/include/etl/wstring.h index 9b28eef2..c2533037 100644 --- a/include/etl/wstring.h +++ b/include/etl/wstring.h @@ -259,7 +259,7 @@ namespace etl template etl::wstring make_string(const wchar_t (&text) [MAX_SIZE]) { - return etl::wstring(text); + return etl::wstring(text, MAX_SIZE - 1); } }