diff --git a/changelog/remove_std_c.dd b/changelog/remove_std_c.dd deleted file mode 100644 index 37b83def468..00000000000 --- a/changelog/remove_std_c.dd +++ /dev/null @@ -1,3 +0,0 @@ -The deprecated `std.c` package has been removed. - -Use the `core.stdc` package instead. diff --git a/changelog/std-algorithm-iteration-joiner.dd b/changelog/std-algorithm-iteration-joiner.dd deleted file mode 100644 index 0ae4b279662..00000000000 --- a/changelog/std-algorithm-iteration-joiner.dd +++ /dev/null @@ -1,19 +0,0 @@ -The performance of `std.algorithm.iteration.joiner` has been improved - -$(H4 DMD) - -$(CONSOLE -> dmd -O -inline -release ./joiner.d && ./joiner -before.joiner = 57 secs, 834 ms, 289 μs, and 3 hnsecs -new.joiner = 44 secs, 936 ms, 706 μs, and 5 hnsecs -) - -$(H4 LDC) - -$(CONSOLE -> ldmd -O3 -release -inline joiner.d && ./joiner -before.joiner = 5 secs, 180 ms, 193 μs, and 7 hnsecs -new.joiner = 3 secs, 168 ms, 560 μs, and 6 hnsecs -) - -The benchmark code can be found $(LINK2 https://gist.github.com/wilzbach/ffd5d20639766a831fd4b1962572897a, here). diff --git a/changelog/std-algorithm-mutation-remove.dd b/changelog/std-algorithm-mutation-remove.dd deleted file mode 100644 index e1c02f3a77e..00000000000 --- a/changelog/std-algorithm-mutation-remove.dd +++ /dev/null @@ -1,27 +0,0 @@ -`std.algorithm.mutation.remove` now only accepts integral values or pair of integral values as offset - -Previously, without being stated in the documentation, -$(REF remove, std,algorithm) used to accept any values as `offset`. -This behavior was very error-prone: - ---- -import std.algorithm, std.stdio; -[0, 1, 2, 3, 4].remove(1, 3).writeln; // 0, 2, 4 -- correct -[0, 1, 2, 3, 4].remove([1, 3]).writeln; // 0, 3, 4 -- incorrect ---- - -With this release, using arrays as individual elements is no longer valid. -$(REF tuple, std,typecons) can be used to explicitly indicate that a range -from `start` to `stop` (non-enclosing) should be removed: - ---- -import std.algorithm, std.stdio, std.typecons; -[0, 1, 2, 3, 4].remove(tuple(1, 3)).writeln; // 0, 3, 4 ---- - -However, only 2-tuples are allowed to avoid this un-intuitive scenario: - ---- -import std.algorithm, std.stdio, std.typecons; -[0, 1, 2, 3, 4].remove(tuple(1, 3, 4)).writeln; // 0, 4? ---- diff --git a/changelog/std-math-fminmax.dd b/changelog/std-math-fminmax.dd deleted file mode 100644 index ff8afb3f55a..00000000000 --- a/changelog/std-math-fminmax.dd +++ /dev/null @@ -1,19 +0,0 @@ -Changed semantics of std.math.{fmin,fmax} wrt. NaNs. - -The semantics of $(REF fmin, std, math) and $(REF fmax, std, math) have been -streamlined with the C functions: if one of the arguments is a NaN, return the -other. This involves an additional $(REF isNaN, std, math) check. Use -$(REF min, std, algorithm, comparison) and $(REF max, std, algorithm, comparison) -for the previous semantics performing a single comparison. - ---- -import std.math; -assert(fmin(real.nan, 2.0L) == 2.0L); -assert(fmin(2.0L, real.nan) == 2.0L); // previously: NaN -assert(isNaN(fmin(real.nan, real.nan))); - -import std.algorithm.comparison; -assert(min(real.nan, 2.0L) == 2.0L); -assert(isNaN(min(2.0L, real.nan))); -assert(isNaN(min(real.nan, real.nan))); ---- diff --git a/std/experimental/allocator/building_blocks/bitmapped_block.d b/std/experimental/allocator/building_blocks/bitmapped_block.d index 04cb468a843..33da3480488 100644 --- a/std/experimental/allocator/building_blocks/bitmapped_block.d +++ b/std/experimental/allocator/building_blocks/bitmapped_block.d @@ -99,7 +99,7 @@ private mixin template BitmappedBlockImpl(bool isShared, bool multiBlock) auto leadingUlongs = blocks.divideRoundUp(64); import std.algorithm.comparison : min; immutable initialAlignment = min(parentAlignment, - 1U << trailingZeros(leadingUlongs * 8)); + 1U << min(31U, trailingZeros(leadingUlongs * 8))); auto maxSlack = alignment <= initialAlignment ? 0 : alignment - initialAlignment; diff --git a/std/experimental/allocator/common.d b/std/experimental/allocator/common.d index 199ce1cb724..202eb5cd00d 100644 --- a/std/experimental/allocator/common.d +++ b/std/experimental/allocator/common.d @@ -287,9 +287,9 @@ Returns the effective alignment of `ptr`, i.e. the largest power of two that is a divisor of `ptr`. */ @nogc nothrow pure -package uint effectiveAlignment(void* ptr) +package size_t effectiveAlignment(void* ptr) { - return 1U << trailingZeros(cast(size_t) ptr); + return (cast(size_t) 1) << trailingZeros(cast(size_t) ptr); } @nogc nothrow pure @@ -297,6 +297,9 @@ package uint effectiveAlignment(void* ptr) { int x; assert(effectiveAlignment(&x) >= int.alignof); + + const max = (cast(size_t) 1) << (size_t.sizeof * 8 - 1); + assert(effectiveAlignment(cast(void*) max) == max); } /*