mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-30 06:18:50 +08:00
Merge remote-tracking branch 'origin/feature/no_stl' into development
This commit is contained in:
commit
aede008c0e
@ -101,6 +101,8 @@
|
||||
<sRunDeb>0</sRunDeb>
|
||||
<sLrtime>0</sLrtime>
|
||||
<bEvRecOn>1</bEvRecOn>
|
||||
<bSchkAxf>0</bSchkAxf>
|
||||
<bTchkAxf>0</bTchkAxf>
|
||||
<nTsel>5</nTsel>
|
||||
<sDll></sDll>
|
||||
<sDllPa></sDllPa>
|
||||
|
||||
@ -10,13 +10,13 @@
|
||||
<TargetName>Target 1</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>6070000::V6.7::.\ARMCLANG</pCCUsed>
|
||||
<uAC6>1</uAC6>
|
||||
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
<Device>STM32F401RETx</Device>
|
||||
<Vendor>STMicroelectronics</Vendor>
|
||||
<PackID>Keil.STM32F4xx_DFP.2.11.0</PackID>
|
||||
<PackID>Keil.STM32F4xx_DFP.2.13.0</PackID>
|
||||
<PackURL>http://www.keil.com/pack</PackURL>
|
||||
<Cpu>IRAM(0x20000000,0x18000) IROM(0x08000000,0x80000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE</Cpu>
|
||||
<FlashUtilSpec></FlashUtilSpec>
|
||||
@ -311,7 +311,7 @@
|
||||
</ArmAdsMisc>
|
||||
<Cads>
|
||||
<interw>1</interw>
|
||||
<Optim>7</Optim>
|
||||
<Optim>1</Optim>
|
||||
<oTime>0</oTime>
|
||||
<SplitLS>0</SplitLS>
|
||||
<OneElfS>1</OneElfS>
|
||||
@ -320,10 +320,11 @@
|
||||
<PlainCh>1</PlainCh>
|
||||
<Ropi>0</Ropi>
|
||||
<Rwpi>0</Rwpi>
|
||||
<wLevel>3</wLevel>
|
||||
<wLevel>2</wLevel>
|
||||
<uThumb>0</uThumb>
|
||||
<uSurpInc>0</uSurpInc>
|
||||
<uC99>1</uC99>
|
||||
<uGnu>0</uGnu>
|
||||
<useXO>0</useXO>
|
||||
<v6Lang>3</v6Lang>
|
||||
<v6LangP>3</v6LangP>
|
||||
@ -421,8 +422,8 @@
|
||||
</api>
|
||||
</apis>
|
||||
<components>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.0.2" condition="ARMv6_7_8-M Device">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.1.1"/>
|
||||
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.1.2" condition="ARMv6_7_8-M Device">
|
||||
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.4.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
@ -439,8 +440,8 @@
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</component>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="2.6.0" condition="STM32F4 CMSIS">
|
||||
<package name="STM32F4xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.11.0"/>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="2.6.2" condition="STM32F4 CMSIS">
|
||||
<package name="STM32F4xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.13.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
@ -449,16 +450,16 @@
|
||||
<files>
|
||||
<file attr="config" category="source" condition="STM32F401xE_ARMCC" name="Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\arm\startup_stm32f401xe.s" version="2.6.0">
|
||||
<instance index="0">RTE\Device\STM32F401RETx\startup_stm32f401xe.s</instance>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="2.6.0" condition="STM32F4 CMSIS"/>
|
||||
<package name="STM32F4xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.11.0"/>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="2.6.2" condition="STM32F4 CMSIS"/>
|
||||
<package name="STM32F4xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.13.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
</file>
|
||||
<file attr="config" category="source" name="Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.c" version="2.6.0">
|
||||
<instance index="0">RTE\Device\STM32F401RETx\system_stm32f4xx.c</instance>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="2.6.0" condition="STM32F4 CMSIS"/>
|
||||
<package name="STM32F4xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.11.0"/>
|
||||
<component Cclass="Device" Cgroup="Startup" Cvendor="Keil" Cversion="2.6.2" condition="STM32F4 CMSIS"/>
|
||||
<package name="STM32F4xx_DFP" schemaVersion="1.3" url="http://www.keil.com/pack" vendor="Keil" version="2.13.0"/>
|
||||
<targetInfos>
|
||||
<targetInfo name="Target 1"/>
|
||||
</targetInfos>
|
||||
|
||||
@ -2,14 +2,13 @@
|
||||
#ifndef __ETL_PROFILE_H__
|
||||
#define __ETL_PROFILE_H__
|
||||
|
||||
#define ETL_THROW_EXCEPTIONS
|
||||
#define ETL_VERBOSE_ERRORS
|
||||
#define ETL_CHECK_PUSH_POP
|
||||
#define ETL_ISTRING_REPAIR_ENABLE
|
||||
#define ETL_IVECTOR_REPAIR_ENABLE
|
||||
#define ETL_IDEQUE_REPAIR_ENABLE
|
||||
#define ETL_IN_UNIT_TEST
|
||||
#define ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK
|
||||
#define ETL_NO_STL
|
||||
|
||||
#if (__CC_ARM == 1)
|
||||
// ARM5 compiler
|
||||
|
||||
@ -33,12 +33,14 @@ SOFTWARE.
|
||||
#include "../type_traits.h"
|
||||
#include "../static_assert.h"
|
||||
#include "../nullptr.h"
|
||||
#include "../char_traits.h"
|
||||
|
||||
//#include <stdatomic.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(ETL_COMPILER_GCC)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
#endif
|
||||
|
||||
namespace etl
|
||||
{
|
||||
@ -785,6 +787,8 @@ namespace etl
|
||||
typedef etl::atomic<uintmax_t> atomic_uintmax_t;
|
||||
}
|
||||
|
||||
#if defined(ETL_COMPILER_GCC)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
785
include/etl/atomic/atomic_llvm_sync.h
Normal file
785
include/etl/atomic/atomic_llvm_sync.h
Normal file
@ -0,0 +1,785 @@
|
||||
/******************************************************************************
|
||||
The MIT License(MIT)
|
||||
|
||||
Embedded Template Library.
|
||||
https://github.com/ETLCPP/etl
|
||||
https://www.etlcpp.com
|
||||
|
||||
Copyright(c) 2017 jwellbelove
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files(the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions :
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef ETL_ATOMIC_LLVM_SYNC_INCLUDED
|
||||
#define ETL_ATOMIC_LLVM_SYNC_INCLUDED
|
||||
|
||||
//#include "../platform.h"
|
||||
//#include "../type_traits.h"
|
||||
//#include "../static_assert.h"
|
||||
//#include "../nullptr.h"
|
||||
//#include "../char_traits.h"
|
||||
//
|
||||
//#include <stdint.h>
|
||||
//
|
||||
//namespace etl
|
||||
//{
|
||||
// //***************************************************************************
|
||||
// // Atomic type for pre C++11 GCC compilers that support the builtin '__sync' functions.
|
||||
// // Only integral and pointer types are supported.
|
||||
// //***************************************************************************
|
||||
//
|
||||
// typedef enum memory_order
|
||||
// {
|
||||
// memory_order_relaxed,
|
||||
// memory_order_consume,
|
||||
// memory_order_acquire,
|
||||
// memory_order_release,
|
||||
// memory_order_acq_rel,
|
||||
// memory_order_seq_cst
|
||||
// } memory_order;
|
||||
//
|
||||
// template <typename T>
|
||||
// class atomic
|
||||
// {
|
||||
// public:
|
||||
//
|
||||
// ETL_STATIC_ASSERT(etl::is_integral<T>::value, "Only integral types are supported");
|
||||
//
|
||||
// atomic()
|
||||
// : value(0)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// atomic(T v)
|
||||
// : value(v)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// // Assignment
|
||||
// T operator =(T v)
|
||||
// {
|
||||
// store(v);
|
||||
//
|
||||
// return v;
|
||||
// }
|
||||
//
|
||||
// T operator =(T v) volatile
|
||||
// {
|
||||
// store(v);
|
||||
//
|
||||
// return v;
|
||||
// }
|
||||
//
|
||||
// // Pre-increment
|
||||
// T operator ++()
|
||||
// {
|
||||
// return fetch_add(1) + 1;
|
||||
// }
|
||||
//
|
||||
// T operator ++() volatile
|
||||
// {
|
||||
// return fetch_add(1) + 1;
|
||||
// }
|
||||
//
|
||||
// // Post-increment
|
||||
// T operator ++(int)
|
||||
// {
|
||||
// return fetch_add(1);
|
||||
// }
|
||||
//
|
||||
// T operator ++(int) volatile
|
||||
// {
|
||||
// return fetch_add(1);
|
||||
// }
|
||||
//
|
||||
// // Pre-decrement
|
||||
// T operator --()
|
||||
// {
|
||||
// return fetch_sub(1) + 1;
|
||||
// }
|
||||
//
|
||||
// T operator --() volatile
|
||||
// {
|
||||
// return fetch_sub(1) + 1;
|
||||
// }
|
||||
//
|
||||
// // Post-decrement
|
||||
// T operator --(int)
|
||||
// {
|
||||
// return fetch_sub(1);
|
||||
// }
|
||||
//
|
||||
// T operator --(int) volatile
|
||||
// {
|
||||
// return fetch_sub(1);
|
||||
// }
|
||||
//
|
||||
// // Add
|
||||
// T operator +=(T v)
|
||||
// {
|
||||
// return fetch_add(v) + v;
|
||||
// }
|
||||
//
|
||||
// T operator +=(T v) volatile
|
||||
// {
|
||||
// return fetch_add(v) + v;
|
||||
// }
|
||||
//
|
||||
// // Subtract
|
||||
// T operator -=(T v)
|
||||
// {
|
||||
// return fetch_sub(v) - v;
|
||||
// }
|
||||
//
|
||||
// T operator -=(T v) volatile
|
||||
// {
|
||||
// return fetch_sub(v) - v;
|
||||
// }
|
||||
//
|
||||
// // And
|
||||
// T operator &=(T v)
|
||||
// {
|
||||
// return fetch_and(v) & v;
|
||||
// }
|
||||
//
|
||||
// T operator &=(T v) volatile
|
||||
// {
|
||||
// return fetch_and(v) & v;
|
||||
// }
|
||||
//
|
||||
// // Or
|
||||
// T operator |=(T v)
|
||||
// {
|
||||
// return fetch_or(v) | v;
|
||||
// }
|
||||
//
|
||||
// T operator |=(T v) volatile
|
||||
// {
|
||||
// return fetch_or(v) | v;
|
||||
// }
|
||||
//
|
||||
// // Exclusive or
|
||||
// T operator ^=(T v)
|
||||
// {
|
||||
// return fetch_xor(v) ^ v;
|
||||
// }
|
||||
//
|
||||
// T operator ^=(T v) volatile
|
||||
// {
|
||||
// return fetch_xor(v) ^ v;
|
||||
// }
|
||||
//
|
||||
// // Conversion operator
|
||||
// operator T () const
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, 0);
|
||||
// }
|
||||
//
|
||||
// operator T() volatile const
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, 0);
|
||||
// }
|
||||
//
|
||||
// // Is lock free?
|
||||
// bool is_lock_free() const
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool is_lock_free() const volatile
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // Store
|
||||
// void store(T v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// __sync_lock_test_and_set(&value, v);
|
||||
// }
|
||||
//
|
||||
// void store(T v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// __sync_lock_test_and_set(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Load
|
||||
// T load(etl::memory_order order = etl::memory_order_seq_cst) const
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, 0);
|
||||
// }
|
||||
//
|
||||
// T load(etl::memory_order order = etl::memory_order_seq_cst) const volatile
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, 0);
|
||||
// }
|
||||
//
|
||||
// // Fetch add
|
||||
// T fetch_add(T v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, v);
|
||||
// }
|
||||
//
|
||||
// T fetch_add(T v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Fetch subtract
|
||||
// T fetch_sub(T v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_fetch_and_sub(&value, v);
|
||||
// }
|
||||
//
|
||||
// T fetch_sub(T v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_fetch_and_sub(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Fetch or
|
||||
// T fetch_or(T v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_fetch_and_or(&value, v);
|
||||
// }
|
||||
//
|
||||
// T fetch_or(T v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_fetch_and_or(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Fetch and
|
||||
// T fetch_and(T v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_fetch_and_and(&value, v);
|
||||
// }
|
||||
//
|
||||
// T fetch_and(T v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_fetch_and_and(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Fetch exclusive or
|
||||
// T fetch_xor(T v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_fetch_and_xor(&value, v);
|
||||
// }
|
||||
//
|
||||
// T fetch_xor(T v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_fetch_and_xor(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Exchange
|
||||
// T exchange(T v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_lock_test_and_set(&value, v);
|
||||
// }
|
||||
//
|
||||
// T exchange(T v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_lock_test_and_set(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Compare exchange weak
|
||||
// bool compare_exchange_weak(T& expected, T desired, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// T old = __sync_val_compare_and_swap(&value, expected, desired);
|
||||
//
|
||||
// if (old == expected)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_weak(T& expected, T desired, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// T old = __sync_val_compare_and_swap(&value, expected, desired);
|
||||
//
|
||||
// if (old == expected)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_weak(T& expected, T desired, etl::memory_order success, etl::memory_order failure)
|
||||
// {
|
||||
// T old = __sync_val_compare_and_swap(&value, expected, desired);
|
||||
//
|
||||
// if (old == expected)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_weak(T& expected, T desired, etl::memory_order success, etl::memory_order failure) volatile
|
||||
// {
|
||||
// T old = __sync_val_compare_and_swap(&value, expected, desired);
|
||||
//
|
||||
// if (old == expected)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Compare exchange strong
|
||||
// bool compare_exchange_strong(T& expected, T desired, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// T old = expected;
|
||||
//
|
||||
// while (!compare_exchange_weak(old, desired))
|
||||
// {
|
||||
// if (memcmp(&old, &expected, sizeof(T)))
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_strong(T& expected, T desired, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// T old = expected;
|
||||
//
|
||||
// while (!compare_exchange_weak(old, desired))
|
||||
// {
|
||||
// if (memcmp(&old, &expected, sizeof(T)))
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_strong(T& expected, T desired, etl::memory_order success, etl::memory_order failure)
|
||||
// {
|
||||
// T old = expected;
|
||||
//
|
||||
// while (!compare_exchange_weak(old, desired))
|
||||
// {
|
||||
// if (memcmp(&old, &expected, sizeof(T)))
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_strong(T& expected, T desired, etl::memory_order success, etl::memory_order failure) volatile
|
||||
// {
|
||||
// T old = expected;
|
||||
//
|
||||
// while (!compare_exchange_weak(old, desired))
|
||||
// {
|
||||
// if (memcmp(&old, &expected, sizeof(T)))
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// private:
|
||||
//
|
||||
// atomic& operator =(const atomic&);
|
||||
// atomic& operator =(const atomic&) volatile;
|
||||
//
|
||||
// mutable volatile T value;
|
||||
// };
|
||||
//
|
||||
// template <typename T>
|
||||
// class atomic<T*>
|
||||
// {
|
||||
// public:
|
||||
//
|
||||
// atomic()
|
||||
// : value(nullptr)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// atomic(T* v)
|
||||
// : value(v)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// // Assignment
|
||||
// T* operator =(T* v)
|
||||
// {
|
||||
// store(v);
|
||||
//
|
||||
// return v;
|
||||
// }
|
||||
//
|
||||
// T* operator =(T* v) volatile
|
||||
// {
|
||||
// store(v);
|
||||
//
|
||||
// return v;
|
||||
// }
|
||||
//
|
||||
// // Pre-increment
|
||||
// T* operator ++()
|
||||
// {
|
||||
// return fetch_add(1) + 1;
|
||||
// }
|
||||
//
|
||||
// T* operator ++() volatile
|
||||
// {
|
||||
// return fetch_add(1) + 1;
|
||||
// }
|
||||
//
|
||||
// // Post-increment
|
||||
// T* operator ++(int)
|
||||
// {
|
||||
// return fetch_add(1);
|
||||
// }
|
||||
//
|
||||
// T* operator ++(int) volatile
|
||||
// {
|
||||
// return fetch_add(1);
|
||||
// }
|
||||
//
|
||||
// // Pre-decrement
|
||||
// T* operator --()
|
||||
// {
|
||||
// return fetch_sub(1) + 1;
|
||||
// }
|
||||
//
|
||||
// T* operator --() volatile
|
||||
// {
|
||||
// return fetch_sub(1) + 1;
|
||||
// }
|
||||
//
|
||||
// // Post-decrement
|
||||
// T* operator --(int)
|
||||
// {
|
||||
// return fetch_sub(1);
|
||||
// }
|
||||
//
|
||||
// T* operator --(int) volatile
|
||||
// {
|
||||
// return fetch_sub(1);
|
||||
// }
|
||||
//
|
||||
// // Add
|
||||
// T* operator +=(ptrdiff_t v)
|
||||
// {
|
||||
// return fetch_add(v) + v;
|
||||
// }
|
||||
//
|
||||
// T* operator +=(ptrdiff_t v) volatile
|
||||
// {
|
||||
// return fetch_add(v) + v;
|
||||
// }
|
||||
//
|
||||
// // Subtract
|
||||
// T* operator -=(ptrdiff_t v)
|
||||
// {
|
||||
// return fetch_sub(v) - v;
|
||||
// }
|
||||
//
|
||||
// T* operator -=(ptrdiff_t v) volatile
|
||||
// {
|
||||
// return fetch_sub(v) - v;
|
||||
// }
|
||||
//
|
||||
// // Conversion operator
|
||||
// operator T* () const
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, 0);
|
||||
// }
|
||||
//
|
||||
// operator T*() volatile const
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, 0);
|
||||
// }
|
||||
//
|
||||
// // Is lock free?
|
||||
// bool is_lock_free() const
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool is_lock_free() const volatile
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// // Store
|
||||
// void store(T* v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// __sync_lock_test_and_set(&value, v);
|
||||
// }
|
||||
//
|
||||
// void store(T* v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// __sync_lock_test_and_set(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Load
|
||||
// T* load(etl::memory_order order = etl::memory_order_seq_cst) const
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, 0);
|
||||
// }
|
||||
//
|
||||
// T* load(etl::memory_order order = etl::memory_order_seq_cst) const volatile
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, 0);
|
||||
// }
|
||||
//
|
||||
// // Fetch add
|
||||
// T* fetch_add(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, v);
|
||||
// }
|
||||
//
|
||||
// T* fetch_add(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_fetch_and_add(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Fetch subtract
|
||||
// T* fetch_sub(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_fetch_and_sub(&value, v);
|
||||
// }
|
||||
//
|
||||
// T* fetch_sub(ptrdiff_t v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_fetch_and_sub(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Exchange
|
||||
// T* exchange(T* v, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// return __sync_lock_test_and_set(&value, v);
|
||||
// }
|
||||
//
|
||||
// T* exchange(T* v, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// return __sync_lock_test_and_set(&value, v);
|
||||
// }
|
||||
//
|
||||
// // Compare exchange weak
|
||||
// bool compare_exchange_weak(T*& expected, T* desired, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// T* old = __sync_val_compare_and_swap(&value, expected, desired);
|
||||
//
|
||||
// if (old == expected)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_weak(T*& expected, T* desired, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// T* old = __sync_val_compare_and_swap(&value, expected, desired);
|
||||
//
|
||||
// if (old == expected)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_weak(T*& expected, T* desired, etl::memory_order success, etl::memory_order failure)
|
||||
// {
|
||||
// T* old = __sync_val_compare_and_swap(&value, expected, desired);
|
||||
//
|
||||
// if (old == expected)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_weak(T*& expected, T* desired, etl::memory_order success, etl::memory_order failure) volatile
|
||||
// {
|
||||
// T* old = __sync_val_compare_and_swap(&value, expected, desired);
|
||||
//
|
||||
// if (old == expected)
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // Compare exchange strong
|
||||
// bool compare_exchange_strong(T*& expected, T* desired, etl::memory_order order = etl::memory_order_seq_cst)
|
||||
// {
|
||||
// T* old = expected;
|
||||
//
|
||||
// while (!compare_exchange_weak(old, desired))
|
||||
// {
|
||||
// if (memcmp(&old, &expected, sizeof(T*)))
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_strong(T*& expected, T* desired, etl::memory_order order = etl::memory_order_seq_cst) volatile
|
||||
// {
|
||||
// T* old = expected;
|
||||
//
|
||||
// while (!compare_exchange_weak(old, desired))
|
||||
// {
|
||||
// if (memcmp(&old, &expected, sizeof(T*)))
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_strong(T*& expected, T* desired, etl::memory_order success, etl::memory_order failure)
|
||||
// {
|
||||
// T* old = expected;
|
||||
//
|
||||
// while (!compare_exchange_weak(old, desired))
|
||||
// {
|
||||
// if (memcmp(&old, &expected, sizeof(T*)))
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// bool compare_exchange_strong(T*& expected, T* desired, etl::memory_order success, etl::memory_order failure) volatile
|
||||
// {
|
||||
// T* old = expected;
|
||||
//
|
||||
// while (!compare_exchange_weak(old, desired))
|
||||
// {
|
||||
// if (memcmp(&old, &expected, sizeof(T*)))
|
||||
// {
|
||||
// expected = old;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// private:
|
||||
//
|
||||
// atomic& operator =(const atomic&);
|
||||
// atomic& operator =(const atomic&) volatile;
|
||||
//
|
||||
// mutable volatile T* value;
|
||||
// };
|
||||
//
|
||||
// typedef etl::atomic<char> atomic_char;
|
||||
// typedef etl::atomic<signed char> atomic_schar;
|
||||
// typedef etl::atomic<unsigned char> atomic_uchar;
|
||||
// typedef etl::atomic<short> atomic_short;
|
||||
// typedef etl::atomic<unsigned short> atomic_ushort;
|
||||
// typedef etl::atomic<int> atomic_int;
|
||||
// typedef etl::atomic<unsigned int> atomic_uint;
|
||||
// typedef etl::atomic<long> atomic_long;
|
||||
// typedef etl::atomic<unsigned long> atomic_ulong;
|
||||
// typedef etl::atomic<long long> atomic_llong;
|
||||
// typedef etl::atomic<unsigned long long> atomic_ullong;
|
||||
// typedef etl::atomic<wchar_t> atomic_wchar_t;
|
||||
// typedef etl::atomic<char16_t> atomic_char16_t;
|
||||
// typedef etl::atomic<char32_t> atomic_char32_t;
|
||||
// typedef etl::atomic<uint8_t> atomic_uint8_t;
|
||||
// typedef etl::atomic<int8_t> atomic_int8_t;
|
||||
// typedef etl::atomic<uint16_t> atomic_uint16_t;
|
||||
// typedef etl::atomic<int16_t> atomic_int16_t;
|
||||
// typedef etl::atomic<uint32_t> atomic_uint32_t;
|
||||
// typedef etl::atomic<int32_t> atomic_int32_t;
|
||||
// typedef etl::atomic<uint64_t> atomic_uint64_t;
|
||||
// typedef etl::atomic<int64_t> atomic_int64_t;
|
||||
// typedef etl::atomic<int_least8_t> atomic_int_least8_t;
|
||||
// typedef etl::atomic<uint_least8_t> atomic_uint_least8_t;
|
||||
// typedef etl::atomic<int_least16_t> atomic_int_least16_t;
|
||||
// typedef etl::atomic<uint_least16_t> atomic_uint_least16_t;
|
||||
// typedef etl::atomic<int_least32_t> atomic_int_least32_t;
|
||||
// typedef etl::atomic<uint_least32_t> atomic_uint_least32_t;
|
||||
// typedef etl::atomic<int_least64_t> atomic_int_least64_t;
|
||||
// typedef etl::atomic<uint_least64_t> atomic_uint_least64_t;
|
||||
// typedef etl::atomic<int_fast8_t> atomic_int_fast8_t;
|
||||
// typedef etl::atomic<uint_fast8_t> atomic_uint_fast8_t;
|
||||
// typedef etl::atomic<int_fast16_t> atomic_int_fast16_t;
|
||||
// typedef etl::atomic<uint_fast16_t> atomic_uint_fast16_t;
|
||||
// typedef etl::atomic<int_fast32_t> atomic_int_fast32_t;
|
||||
// typedef etl::atomic<uint_fast32_t> atomic_uint_fast32_t;
|
||||
// typedef etl::atomic<int_fast64_t> atomic_int_fast64_t;
|
||||
// typedef etl::atomic<uint_fast64_t> atomic_uint_fast64_t;
|
||||
// typedef etl::atomic<intptr_t> atomic_intptr_t;
|
||||
// typedef etl::atomic<uintptr_t> atomic_uintptr_t;
|
||||
// typedef etl::atomic<size_t> atomic_size_t;
|
||||
// typedef etl::atomic<ptrdiff_t> atomic_ptrdiff_t;
|
||||
// typedef etl::atomic<intmax_t> atomic_intmax_t;
|
||||
// typedef etl::atomic<uintmax_t> atomic_uintmax_t;
|
||||
//}
|
||||
|
||||
#endif
|
||||
@ -31,6 +31,7 @@ SOFTWARE.
|
||||
|
||||
#include "../platform.h"
|
||||
#include "../nullptr.h"
|
||||
#include "../char_traits.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -1922,7 +1922,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
void repair(T* p_buffer_)
|
||||
void repair_buffer(T* p_buffer_)
|
||||
{
|
||||
p_buffer = p_buffer_;
|
||||
}
|
||||
|
||||
@ -30,9 +30,10 @@ SOFTWARE.
|
||||
#define ETL_CALLBACK_TIMER_INCLUDED
|
||||
|
||||
#include <stdint.h>
|
||||
#include "algorithm.h"
|
||||
#include <new>
|
||||
|
||||
#include "platform.h"
|
||||
#include "algorithm.h"
|
||||
#include "nullptr.h"
|
||||
#include "function.h"
|
||||
#include "static_assert.h"
|
||||
|
||||
@ -189,9 +189,12 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
#ifdef ETL_ISTRING_REPAIR_ENABLE
|
||||
virtual
|
||||
#endif
|
||||
void repair()
|
||||
{
|
||||
etl::istring::repair(buffer);
|
||||
etl::istring::repair_buffer(buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -1828,7 +1828,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
void repair(pointer p_buffer_)
|
||||
void repair_buffer(pointer p_buffer_)
|
||||
{
|
||||
p_buffer = p_buffer_;
|
||||
|
||||
@ -2095,13 +2095,16 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
#ifdef ETL_IDEQUE_REPAIR_ENABLE
|
||||
virtual
|
||||
#endif
|
||||
void repair()
|
||||
{
|
||||
#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
|
||||
ETL_ASSERT(std::is_trivially_copyable<T>::value, ETL_ERROR(etl::deque_incompatible_type));
|
||||
#endif
|
||||
|
||||
etl::ideque<T>::repair(reinterpret_cast<T*>(&buffer[0]));
|
||||
etl::ideque<T>::repair_buffer(reinterpret_cast<T*>(&buffer[0]));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -872,7 +872,7 @@ namespace etl
|
||||
std::swap(p, value.p);
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR explicit operator bool() const
|
||||
ETL_CONSTEXPR operator bool() const
|
||||
{
|
||||
return (p != nullptr);
|
||||
}
|
||||
@ -1006,7 +1006,7 @@ namespace etl
|
||||
std::swap(p, v.p);
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR explicit operator bool() const
|
||||
ETL_CONSTEXPR operator bool() const
|
||||
{
|
||||
return (p != nullptr);
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ namespace etl
|
||||
|
||||
void initialise();
|
||||
|
||||
void repair(void** p_buffer_);
|
||||
void repair_buffer(void** p_buffer_);
|
||||
|
||||
void** p_buffer;
|
||||
void** p_end;
|
||||
|
||||
@ -292,6 +292,27 @@ SOFTWARE.
|
||||
memset(first, value, last - first);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
// fill_n
|
||||
template<typename TIterator, typename TSize, typename TValue>
|
||||
typename etl::enable_if<!(etl::is_same<char, TValue>::value || etl::is_same<unsigned char, TValue>::value) || !etl::is_pointer<TIterator>::value, TIterator>::type
|
||||
fill_n(TIterator first, TSize count, const TValue& value)
|
||||
{
|
||||
for (TSize i = 0; i < count; ++i)
|
||||
{
|
||||
*first++ = value;
|
||||
}
|
||||
|
||||
return first;
|
||||
}
|
||||
|
||||
template<typename TIterator, typename TSize, typename TValue>
|
||||
typename etl::enable_if<(etl::is_same<char, TValue>::value || etl::is_same<unsigned char, TValue>::value) && etl::is_pointer<TIterator>::value, void>::type
|
||||
fill_n(TIterator first, TSize count, const TValue& value)
|
||||
{
|
||||
memset(first, value, count);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
// count
|
||||
template <typename TIterator, typename T>
|
||||
@ -447,6 +468,30 @@ SOFTWARE.
|
||||
return ETLSTD::max(a, b, compare());
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
// transform
|
||||
template <typename TIteratorIn, typename TIteratorOut, typename TUnaryOperation>
|
||||
TIteratorOut transform(TIteratorIn first1, TIteratorIn last1, TIteratorOut d_first, TUnaryOperation unary_operation)
|
||||
{
|
||||
while (first1 != last1)
|
||||
{
|
||||
*d_first++ = unary_operation(*first1++);
|
||||
}
|
||||
|
||||
return d_first;
|
||||
}
|
||||
|
||||
template <typename TIteratorIn1, typename TIteratorIn2, typename TIteratorOut, typename TBinaryOperation>
|
||||
TIteratorOut transform(TIteratorIn1 first1, TIteratorIn1 last1, TIteratorIn2 first2, TIteratorOut d_first, TBinaryOperation binary_operation)
|
||||
{
|
||||
while (first1 != last1)
|
||||
{
|
||||
*d_first++ = binary_operation(*first1++, *first2++);
|
||||
}
|
||||
|
||||
return d_first;
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
// Heap
|
||||
namespace private_heap
|
||||
|
||||
@ -141,4 +141,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -267,69 +267,69 @@ namespace std
|
||||
return current;
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reference operator *() const
|
||||
reference operator *() const
|
||||
{
|
||||
TIterator temp = current;
|
||||
--temp;
|
||||
return *temp;
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR pointer operator ->() const
|
||||
pointer operator ->() const
|
||||
{
|
||||
TIterator temp = current;
|
||||
--temp;
|
||||
return &(*temp);
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reverse_iterator<TIterator>& operator ++()
|
||||
reverse_iterator<TIterator>& operator ++()
|
||||
{
|
||||
--current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reverse_iterator<TIterator> operator ++(int)
|
||||
reverse_iterator<TIterator> operator ++(int)
|
||||
{
|
||||
reverse_iterator<TIterator> temp = *this;
|
||||
--current;
|
||||
return temp;
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reverse_iterator<TIterator>& operator --()
|
||||
reverse_iterator<TIterator>& operator --()
|
||||
{
|
||||
++current;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reverse_iterator<TIterator> operator --(int)
|
||||
reverse_iterator<TIterator> operator --(int)
|
||||
{
|
||||
reverse_iterator<TIterator> temp = *this;
|
||||
++current;
|
||||
return temp;
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reverse_iterator<TIterator> operator +(difference_type n) const
|
||||
reverse_iterator<TIterator> operator +(difference_type n) const
|
||||
{
|
||||
return reverse_iterator<TIterator>(current - n);
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reverse_iterator<TIterator>& operator +=(difference_type n)
|
||||
reverse_iterator<TIterator>& operator +=(difference_type n)
|
||||
{
|
||||
current -= n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reverse_iterator<TIterator> operator -(difference_type n) const
|
||||
reverse_iterator<TIterator> operator -(difference_type n) const
|
||||
{
|
||||
return reverse_iterator<TIterator>(current + n);
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reverse_iterator<TIterator>& operator -=(difference_type n)
|
||||
reverse_iterator<TIterator>& operator -=(difference_type n)
|
||||
{
|
||||
current += n;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ETL_CONSTEXPR reference operator [](difference_type n) const
|
||||
reference operator [](difference_type n) const
|
||||
{
|
||||
return *(*this + n);
|
||||
}
|
||||
@ -340,43 +340,43 @@ namespace std
|
||||
};
|
||||
|
||||
template <class TIterator>
|
||||
inline ETL_CONSTEXPR bool operator <(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
inline bool operator <(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
{
|
||||
return rhs.base() < lhs.base();
|
||||
}
|
||||
|
||||
template <class TIterator>
|
||||
inline ETL_CONSTEXPR bool operator !=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
inline bool operator !=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <class TIterator>
|
||||
inline ETL_CONSTEXPR bool operator >(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
inline bool operator >(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
{
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
template <class TIterator>
|
||||
inline ETL_CONSTEXPR bool operator <=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
inline bool operator <=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
{
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
|
||||
template <class TIterator>
|
||||
inline ETL_CONSTEXPR bool operator >=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
inline bool operator >=(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
template <class TIterator>
|
||||
inline ETL_CONSTEXPR typename reverse_iterator<TIterator>::difference_type operator -(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
inline typename reverse_iterator<TIterator>::difference_type operator -(const reverse_iterator<TIterator>& lhs, const reverse_iterator<TIterator>& rhs)
|
||||
{
|
||||
return rhs.base() - lhs.base();
|
||||
}
|
||||
|
||||
template <class TIterator, class TDifference>
|
||||
inline ETL_CONSTEXPR reverse_iterator<TIterator> operator +(TDifference n, const reverse_iterator<TIterator>& itr)
|
||||
inline reverse_iterator<TIterator> operator +(TDifference n, const reverse_iterator<TIterator>& itr)
|
||||
{
|
||||
return itr.operator +(n);
|
||||
}
|
||||
|
||||
@ -193,9 +193,12 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
#ifdef ETL_ISTRING_REPAIR_ENABLE
|
||||
virtual
|
||||
#endif
|
||||
void repair()
|
||||
{
|
||||
etl::iu16string::repair(buffer);
|
||||
etl::iu16string::repair_buffer(buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -193,9 +193,12 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
#ifdef ETL_ISTRING_REPAIR_ENABLE
|
||||
virtual
|
||||
#endif
|
||||
void repair()
|
||||
{
|
||||
etl::iu32string::repair(buffer);
|
||||
etl::iu32string::repair_buffer(buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -868,7 +868,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
void repair(T* p_buffer_)
|
||||
void repair_buffer(T* p_buffer_)
|
||||
{
|
||||
uintptr_t length = p_end - p_buffer;
|
||||
p_buffer = p_buffer_;
|
||||
@ -1112,13 +1112,16 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
#ifdef ETL_IVECTOR_REPAIR_ENABLE
|
||||
virtual
|
||||
#endif
|
||||
void repair()
|
||||
{
|
||||
#if ETL_CPP11_TYPE_TRAITS_IS_TRIVIAL_SUPPORTED
|
||||
ETL_ASSERT(std::is_trivially_copyable<T>::value, ETL_ERROR(etl::vector_incompatible_type));
|
||||
#endif
|
||||
|
||||
etl::ivector<T>::repair(buffer);
|
||||
etl::ivector<T>::repair_buffer(buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -1222,7 +1225,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void repair()
|
||||
{
|
||||
etl::ivector<T*>::repair(buffer);
|
||||
etl::ivector<T*>::repair_buffer(buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -194,9 +194,12 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
#ifdef ETL_ISTRING_REPAIR_ENABLE
|
||||
virtual
|
||||
#endif
|
||||
void repair()
|
||||
{
|
||||
etl::iwstring::repair(buffer);
|
||||
etl::iwstring::repair_buffer(buffer);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@ -479,7 +479,7 @@ void etl::pvoidvector::initialise()
|
||||
//*************************************************************************
|
||||
/// Fix the internal pointers after a low level memory copy.
|
||||
//*************************************************************************
|
||||
void etl::pvoidvector::repair(void** p_buffer_)
|
||||
void etl::pvoidvector::repair_buffer(void** p_buffer_)
|
||||
{
|
||||
uintptr_t length = p_end - p_buffer;
|
||||
|
||||
|
||||
@ -57,6 +57,9 @@ namespace
|
||||
typedef std::list<int> List;
|
||||
List dataL = { 2, 1, 4, 3, 6, 5, 8, 7, 10, 9 };
|
||||
|
||||
int dataD1[SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
int dataD2[SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
class Data
|
||||
{
|
||||
public:
|
||||
@ -591,5 +594,57 @@ namespace
|
||||
|
||||
CHECK(c1 == c2);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(fill_n)
|
||||
{
|
||||
int* p1 = std::fill_n(std::begin(dataD1), SIZE, 5);
|
||||
int* p2 = etlstd::fill_n(std::begin(dataD2), SIZE, 5);
|
||||
|
||||
CHECK(p2 == std::end(dataD2));
|
||||
|
||||
bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2));
|
||||
CHECK(isEqual);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(transform1)
|
||||
{
|
||||
struct Function
|
||||
{
|
||||
int operator()(int d) const
|
||||
{
|
||||
return d * 2;
|
||||
}
|
||||
};
|
||||
|
||||
int* p1 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataD1), Function());
|
||||
int* p2 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataD2), Function());
|
||||
|
||||
CHECK(p2 == std::end(dataD2));
|
||||
|
||||
bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2));
|
||||
CHECK(isEqual);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(transform2)
|
||||
{
|
||||
struct Function
|
||||
{
|
||||
int operator()(int d1, int d2) const
|
||||
{
|
||||
return d1 + d2;
|
||||
}
|
||||
};
|
||||
|
||||
int* p1 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataA), std::begin(dataD1), Function());
|
||||
int* p2 = std::transform(std::begin(dataS), std::end(dataS), std::begin(dataA), std::begin(dataD2), Function());
|
||||
|
||||
CHECK(p2 == std::end(dataD2));
|
||||
|
||||
bool isEqual = std::equal(std::begin(dataD1), std::end(dataD1), std::begin(dataD2));
|
||||
CHECK(isEqual);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -360,6 +360,7 @@
|
||||
<ClInclude Include="..\..\include\etl\atomic.h" />
|
||||
<ClInclude Include="..\..\include\etl\atomic\atomic_arm.h" />
|
||||
<ClInclude Include="..\..\include\etl\atomic\atomic_gcc_sync.h" />
|
||||
<ClInclude Include="..\..\include\etl\atomic\atomic_llvm_sync.h" />
|
||||
<ClInclude Include="..\..\include\etl\atomic\atomic_std.h" />
|
||||
<ClInclude Include="..\..\include\etl\callback_timer.h" />
|
||||
<ClInclude Include="..\..\include\etl\combinations.h" />
|
||||
|
||||
@ -690,6 +690,9 @@
|
||||
<ClInclude Include="..\no_stl_test_iterators.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\etl\atomic\atomic_llvm_sync.h">
|
||||
<Filter>ETL\Utilities\Atomic</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\main.cpp">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user