Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# https://releases.llvm.org/10.0.0/tools/clang/docs/ClangFormatStyleOptions.html
# https://releases.llvm.org/11.0.0/tools/clang/docs/ClangFormatStyleOptions.html

---
# Language: Cpp
Expand All @@ -14,15 +14,18 @@ AlignAfterOpenBracket: DontAlign
AlignConsecutiveMacros: true
# AlignConsecutiveAssignments: false
AlignConsecutiveAssignments: true
# AlignConsecutiveBitFields: false
# AlignConsecutiveDeclarations: false
# AlignEscapedNewlines: Right
AlignEscapedNewlines: Left
# AlignOperands: true
# AlignOperands: Align
AlignOperands: AlignAfterOperator
# AlignTrailingComments: true
AlignTrailingComments: false
# AllowAllArgumentsOnNextLine: true
# AllowAllConstructorInitializersOnNextLine: true
# AllowAllParametersOfDeclarationOnNextLine: true
# AllowShortEnumsOnASingleLine: true
# AllowShortBlocksOnASingleLine: Never
# AllowShortCaseLabelsOnASingleLine: false
# AllowShortFunctionsOnASingleLine: All
Expand All @@ -40,7 +43,7 @@ AlwaysBreakTemplateDeclarations: Yes
# BraceWrapping:
# AfterCaseLabel: false
# AfterClass: false
# AfterControlStatement: false
# AfterControlStatement: Never
# AfterEnum: false
# AfterFunction: false
# AfterNamespace: false
Expand All @@ -50,6 +53,8 @@ AlwaysBreakTemplateDeclarations: Yes
# AfterExternBlock: false
# BeforeCatch: false
# BeforeElse: false
# BeforeLambdaBody: false
# BeforeWhile: false
# IndentBraces: false
# SplitEmptyFunction: true
# SplitEmptyRecord: true
Expand Down Expand Up @@ -112,12 +117,16 @@ IncludeCategories:
# IncludeIsMainRegex: '(Test)?$'
# IncludeIsMainSourceRegex: ''
# IndentCaseLabels: false
# IndentCaseBlocks: false
IndentCaseBlocks: true
# IndentGotoLabels: true
# IndentPPDirectives: None
# IndentExternBlock: AfterExternBlock
# IndentWidth: 2
IndentWidth: 4
# IndentWrappedFunctionNames: false
IndentWrappedFunctionNames: true
# InsertTrailingCommas: None
# JavaScriptQuotes: Leave
# JavaScriptWrapImports: true
# KeepEmptyLinesAtTheStartOfBlocks: true
Expand All @@ -130,6 +139,7 @@ MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
# ObjCBinPackProtocolList: Auto
# ObjCBlockIndentWidth: 2
# ObjCBreakBeforeNestedBlockParam: true
# ObjCSpaceAfterProperty: false
# ObjCSpaceBeforeProtocolList: true
# PenaltyBreakAssignment: 2
Expand Down Expand Up @@ -184,4 +194,8 @@ StatementMacros:
# UseCRLF: false
UseCRLF: true
# UseTab: Never
# WhitespaceSensitiveMacros:
# - STRINGIZE
# - PP_STRINGIZE
# - BOOST_PP_STRINGIZE
...
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ project(msvc_standard_libraries LANGUAGES CXX)

find_package(Boost REQUIRED)

set(VCLIBS_MIN_BOOST_VERSION 1.73.0)
set(VCLIBS_MIN_BOOST_VERSION 1.74.0)
if("${Boost_VERSION}" VERSION_LESS "${VCLIBS_MIN_BOOST_VERSION}")
message(FATAL_ERROR "Detected Boost version is too old (older than ${VCLIBS_MIN_BOOST_VERSION}).")
endif()
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ Just try to follow these rules, so we can spend more time fixing bugs and implem
The STL uses boost-math headers to provide P0226R1 Mathematical Special Functions. We recommend using [vcpkg][] to
acquire this dependency.

1. Install Visual Studio 2019 16.9 Preview 1 or later.
1. Install Visual Studio 2019 16.9 Preview 2 or later.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
This will ensure that you're using supported versions of CMake and Ninja.
* Otherwise, install [CMake][] 3.18 or later, and [Ninja][] 1.8.2 or later.
Expand All @@ -158,7 +158,7 @@ acquire this dependency.

# How To Build With A Native Tools Command Prompt

1. Install Visual Studio 2019 16.9 Preview 1 or later.
1. Install Visual Studio 2019 16.9 Preview 2 or later.
* We recommend selecting "C++ CMake tools for Windows" in the VS Installer.
This will ensure that you're using supported versions of CMake and Ninja.
* Otherwise, install [CMake][] 3.18 or later, and [Ninja][] 1.8.2 or later.
Expand Down
4 changes: 2 additions & 2 deletions azure-devops/provision-image.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ Function InstallWindowsDriverKit {
[string]$installerPath = Get-TempFilePath -Extension 'exe'
curl.exe -L -o $installerPath -s -S $Url
Write-Host 'Installing the Windows Driver Kit...'
$proc = Start-Process -FilePath $installerPath -ArgumentList `
@('/quiet', '/features', 'OptionId.WindowsDriverKitComplete') -Wait -PassThru
$proc = Start-Process -FilePath cmd.exe -ArgumentList `
@('/c', 'start', '/wait', $installerPath, '/quiet', '/features', '+') -Wait -PassThru
$exitCode = $proc.ExitCode
if ($exitCode -eq 0) {
Write-Host 'Installation successful!'
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
variables:
tmpDir: 'D:\Temp'

pool: 'StlBuild-2020-11-10'
pool: 'StlBuild-2020-12-08'

stages:
- stage: Code_Format
Expand Down
4 changes: 2 additions & 2 deletions stl/inc/any
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ inline constexpr size_t _Any_trivial_space_size = (_Small_object_num_ptrs - 1) *

template <class _Ty>
inline constexpr bool _Any_is_trivial = alignof(_Ty) <= alignof(max_align_t)
&& is_trivially_copyable_v<_Ty> && sizeof(_Ty) <= _Any_trivial_space_size;
&& is_trivially_copyable_v<_Ty> && sizeof(_Ty) <= _Any_trivial_space_size;

inline constexpr size_t _Any_small_space_size = (_Small_object_num_ptrs - 2) * sizeof(void*);

template <class _Ty>
inline constexpr bool _Any_is_small = alignof(_Ty) <= alignof(max_align_t)
&& is_nothrow_move_constructible_v<_Ty> && sizeof(_Ty) <= _Any_small_space_size;
&& is_nothrow_move_constructible_v<_Ty> && sizeof(_Ty) <= _Any_small_space_size;

enum class _Any_representation : uintptr_t { _Trivial, _Big, _Small };

Expand Down
13 changes: 6 additions & 7 deletions stl/inc/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,14 @@ struct _Atomic_padded {
// STRUCT TEMPLATE _Atomic_storage_traits
template <class _Ty>
struct _Atomic_storage_traits { // properties for how _Ty is stored in an atomic
static constexpr size_t _Storage_size =
sizeof(_Ty) == 1 ? 1
: sizeof(_Ty) == 2 ? 2
: sizeof(_Ty) <= 4 ? 4
: sizeof(_Ty) <= 8 ? 8
static constexpr size_t _Storage_size = sizeof(_Ty) == 1 ? 1
: sizeof(_Ty) == 2 ? 2
: sizeof(_Ty) <= 4 ? 4
: sizeof(_Ty) <= 8 ? 8
#if defined(_M_X64) || defined(_M_ARM64) || defined(_M_ARM64EC)
: sizeof(_Ty) <= 16 ? 16
: sizeof(_Ty) <= 16 ? 16
#endif // 64 bits
: sizeof(_Ty);
: sizeof(_Ty);

static constexpr size_t _Padding_size = _Storage_size - sizeof(_Ty);
static constexpr bool _Uses_padding = _Padding_size != 0;
Expand Down
2 changes: 1 addition & 1 deletion stl/inc/bit
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ _NODISCARD int _Checked_x86_x64_countl_zero(const _Ty _Val) noexcept {

template <class _Ty>
_NODISCARD int _Checked_x86_x64_popcount(const _Ty _Val) noexcept {
constexpr int _Digits = numeric_limits<_Ty>::digits;
constexpr int _Digits = numeric_limits<_Ty>::digits;
#ifndef __AVX__
const bool _Definitely_have_popcnt = __isa_available >= __ISA_AVAILABLE_SSE42;
if (!_Definitely_have_popcnt) {
Expand Down
71 changes: 36 additions & 35 deletions stl/inc/charconv
Original file line number Diff line number Diff line change
Expand Up @@ -62,34 +62,35 @@ _NODISCARD to_chars_result _Integer_to_chars(
char* _RNext = _Buff_end;

switch (_Base) {
case 10: { // Derived from _UIntegral_to_buff()
// Performance note: Ryu's digit table should be faster here.
constexpr bool _Use_chunks = sizeof(_Unsigned) > sizeof(size_t);

if constexpr (_Use_chunks) { // For 64-bit numbers on 32-bit platforms, work in chunks to avoid 64-bit
// divisions.
while (_Value > 0xFFFF'FFFFU) {
// Performance note: Ryu's division workaround would be faster here.
unsigned long _Chunk = static_cast<unsigned long>(_Value % 1'000'000'000);
_Value = static_cast<_Unsigned>(_Value / 1'000'000'000);

for (int _Idx = 0; _Idx != 9; ++_Idx) {
*--_RNext = static_cast<char>('0' + _Chunk % 10);
_Chunk /= 10;
case 10:
{ // Derived from _UIntegral_to_buff()
// Performance note: Ryu's digit table should be faster here.
constexpr bool _Use_chunks = sizeof(_Unsigned) > sizeof(size_t);

if constexpr (_Use_chunks) { // For 64-bit numbers on 32-bit platforms, work in chunks to avoid 64-bit
// divisions.
while (_Value > 0xFFFF'FFFFU) {
// Performance note: Ryu's division workaround would be faster here.
unsigned long _Chunk = static_cast<unsigned long>(_Value % 1'000'000'000);
_Value = static_cast<_Unsigned>(_Value / 1'000'000'000);

for (int _Idx = 0; _Idx != 9; ++_Idx) {
*--_RNext = static_cast<char>('0' + _Chunk % 10);
_Chunk /= 10;
}
}
}
}

using _Truncated = conditional_t<_Use_chunks, unsigned long, _Unsigned>;
using _Truncated = conditional_t<_Use_chunks, unsigned long, _Unsigned>;

_Truncated _Trunc = static_cast<_Truncated>(_Value);
_Truncated _Trunc = static_cast<_Truncated>(_Value);

do {
*--_RNext = static_cast<char>('0' + _Trunc % 10);
_Trunc /= 10;
} while (_Trunc != 0);
break;
}
do {
*--_RNext = static_cast<char>('0' + _Trunc % 10);
_Trunc /= 10;
} while (_Trunc != 0);
break;
}

case 2:
do {
Expand Down Expand Up @@ -406,8 +407,8 @@ struct _Big_integer_flt {
}

static constexpr uint32_t _Maximum_bits = 1074 // 1074 bits required to represent 2^1074
+ 2552 // ceil(log2(10^768))
+ 54; // shift space
+ 2552 // ceil(log2(10^768))
+ 54; // shift space

static constexpr uint32_t _Element_bits = 32;

Expand Down Expand Up @@ -1022,7 +1023,7 @@ _NODISCARD inline uint64_t _Divide(_Big_integer_flt& _Numerator, const _Big_inte
uint32_t _U_carry = 0;
for (uint32_t _Iu2 = 0; _Iu2 < _Cu_den; ++_Iu2) {
const uint64_t _Sum = static_cast<uint64_t>(_Numerator._Mydata[_Iu + _Iu2])
+ static_cast<uint64_t>(_Denominator._Mydata[_Iu2]) + _U_carry;
+ static_cast<uint64_t>(_Denominator._Mydata[_Iu2]) + _U_carry;

_Numerator._Mydata[_Iu + _Iu2] = static_cast<uint32_t>(_Sum);
_U_carry = static_cast<uint32_t>(_Sum >> 32);
Expand Down Expand Up @@ -1376,7 +1377,7 @@ _NODISCARD errc _Assemble_floating_point_value_from_big_integer_flt(const _Big_i
const int32_t _Exponent = static_cast<int32_t>(_Base_exponent + _Bottom_element_index * 32);

const uint64_t _Mantissa = _Integer_value._Mydata[_Bottom_element_index]
+ (static_cast<uint64_t>(_Integer_value._Mydata[_Middle_element_index]) << 32);
+ (static_cast<uint64_t>(_Integer_value._Mydata[_Middle_element_index]) << 32);

bool _Has_zero_tail = !_Has_nonzero_fractional_part;
for (uint32_t _Ix = 0; _Has_zero_tail && _Ix != _Bottom_element_index; ++_Ix) {
Expand Down Expand Up @@ -1527,8 +1528,8 @@ _NODISCARD errc _Convert_decimal_string_to_floating_type(
const uint32_t _Fractional_denominator_bits = _Bit_scan_reverse(_Fractional_denominator);

const uint32_t _Fractional_shift = _Fractional_denominator_bits > _Fractional_numerator_bits
? _Fractional_denominator_bits - _Fractional_numerator_bits
: 0;
? _Fractional_denominator_bits - _Fractional_numerator_bits
: 0;

if (_Fractional_shift > 0) {
[[maybe_unused]] const bool _Shift_success1 =
Expand Down Expand Up @@ -1595,8 +1596,8 @@ _NODISCARD errc _Convert_decimal_string_to_floating_type(
// Then, in both cases, we subtract an additional one from the exponent,
// to account for the fact that we've generated an extra bit of precision, for use in rounding.
const int32_t _Final_exponent = _Integer_bits_of_precision > 0
? static_cast<int32_t>(_Integer_bits_of_precision - 2)
: -static_cast<int32_t>(_Fractional_exponent) - 1;
? static_cast<int32_t>(_Integer_bits_of_precision - 2)
: -static_cast<int32_t>(_Fractional_exponent) - 1;

return _Assemble_floating_point_value(
_Complete_mantissa, _Final_exponent, _Data._Myis_negative, _Has_zero_tail, _Result);
Expand Down Expand Up @@ -2143,10 +2144,10 @@ _NODISCARD to_chars_result _Floating_to_chars_hex_precision(
_Buffer_size -= _Precision;

const int32_t _Length_excluding_precision = 1 // leading hexit
+ static_cast<int32_t>(_Precision > 0) // possible decimal point
// excluding `+ _Precision`, hexits after decimal point
+ 2 // "p+" or "p-"
+ _Exponent_length; // exponent
+ static_cast<int32_t>(_Precision > 0) // possible decimal point
// excluding `+ _Precision`, hexits after decimal point
+ 2 // "p+" or "p-"
+ _Exponent_length; // exponent

if (_Buffer_size < _Length_excluding_precision) {
return {_Last, errc::value_too_large};
Expand Down
Loading