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
2 changes: 1 addition & 1 deletion std/complex.d
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ deprecated
assert(coshisinh(3.0L) == complex(std.math.cosh(3.0L), std.math.sinh(3.0L)));
auto z1 = coshisinh(1.234);
auto z2 = std.math.coshisinh(1.234);
static if (real.mant_dig == 53)
static if (real.mant_dig == 53 || real.mant_dig == 113)
{
assert(std.math.feqrel(z1.re, z2.re) >= real.mant_dig - 1 &&
std.math.feqrel(z1.im, z2.im) >= real.mant_dig - 1);
Expand Down
2 changes: 1 addition & 1 deletion std/file.d
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ version (Windows) private void[] readImpl(scope const(char)[] name, scope const(
version (linux) @safe unittest
{
// A file with "zero" length that doesn't have 0 length at all
auto s = std.file.readText("/proc/sys/kernel/osrelease");
auto s = std.file.readText("/proc/cpuinfo");
assert(s.length > 0);
//writefln("'%s'", s);
}
Expand Down
2 changes: 1 addition & 1 deletion std/math.d
Original file line number Diff line number Diff line change
Expand Up @@ -4110,7 +4110,7 @@ real log(real x) @safe pure nothrow @nogc
///
@safe pure nothrow @nogc unittest
{
assert(log(E) == 1);
assert(feqrel(log(E), 1) >= real.mant_dig - 1);
Copy link
Copy Markdown
Contributor Author

@joakim-noah joakim-noah Dec 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assert for equality only trips on Android with Quad reals, but not on linux/glibc/AArch64. Since it's a documented test, I can version this only for IEEE Quadruples like the std.complex test above and keep this simpler assert for readability if wanted.

}

/**************************************
Expand Down
2 changes: 1 addition & 1 deletion std/traits.d
Original file line number Diff line number Diff line change
Expand Up @@ -4759,7 +4759,7 @@ template TemplateArgsOf(T : Base!Args, alias Base, Args...)
}


private template maxAlignment(U...)
package template maxAlignment(U...)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This protection plus the modification was why I copied it before.

if (isTypeTuple!U)
{
import std.meta : staticMap;
Expand Down
16 changes: 15 additions & 1 deletion std/variant.d
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,20 @@ struct This;

private alias This2Variant(V, T...) = AliasSeq!(ReplaceType!(This, V, T));

// We can't just use maxAlignment because no types might be specified
// to VariantN, so handle that here and then pass along the rest.
private template maxVariantAlignment(U...)
if (isTypeTuple!U)
{
static if (U.length == 0)
{
import std.algorithm.comparison : max;
enum maxVariantAlignment = max(real.alignof, size_t.alignof);
}
else
enum maxVariantAlignment = maxAlignment!(U);
}

/**
* Back-end type seldom used directly by user
* code. Two commonly-used types using `VariantN` are:
Expand Down Expand Up @@ -169,7 +183,7 @@ private:
= &handler!(void);
union
{
ubyte[size] store;
align(maxVariantAlignment!(AllowedTypes)) ubyte[size] store;
// conservatively mark the region as pointers
static if (size >= (void*).sizeof)
void*[size / (void*).sizeof] p;
Expand Down