Update compiler, remove deprecated modules

This commit is contained in:
2020-05-04 06:03:45 +02:00
parent 048939410c
commit c68b8d1bdd
14 changed files with 13 additions and 2206 deletions

View File

@ -14,6 +14,7 @@
*/
module tanya.algorithm.comparison;
import std.traits : CommonType;
import tanya.algorithm.mutation;
import tanya.math;
static import tanya.memory.op;

View File

@ -14,6 +14,7 @@
*/
module tanya.conv;
import std.traits : Unsigned;
import tanya.container.string;
import tanya.memory.allocator;
deprecated("Use tanya.memory.lifetime.emplace instead")

View File

@ -1,16 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Copyright: Eugene Wissner 2017-2019.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
* Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/exception.d,
* tanya/exception.d)
*/
deprecated("Use tanya.memory.allocator instead")
module tanya.exception;
public import tanya.memory.allocator : onOutOfMemoryError, OutOfMemoryError;

View File

@ -1,18 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Functions that manipulate other functions and their argument lists.
*
* Copyright: Eugene Wissner 2018-2019.
* License: $(LINK2 https://www.mozilla.org/en-US/MPL/2.0/,
* Mozilla Public License, v. 2.0).
* Authors: $(LINK2 mailto:info@caraus.de, Eugene Wissner)
* Source: $(LINK2 https://github.com/caraus-ecms/tanya/blob/master/source/tanya/functional.d,
* tanya/functional.d)
*/
deprecated("Use tanya.memory.lifetime instead")
module tanya.functional;
public import tanya.memory.lifetime : forward;

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,6 @@
*/
module tanya.math.nbtheory;
import tanya.math.mp;
import tanya.meta.trait;
import tanya.meta.transform;
@ -91,21 +90,6 @@ if (isFloatingPoint!T)
static assert(is(typeof(r.abs) == real));
}
/// ditto
T abs(T : Integer)(const auto ref T x)
{
auto result = Integer(x, x.allocator);
result.sign = Sign.positive;
return result;
}
/// ditto
T abs(T : Integer)(T x)
{
x.sign = Sign.positive;
return x;
}
version (D_Ddoc)
{
/**

View File

@ -21,7 +21,6 @@
*/
module tanya.math;
import tanya.math.mp;
import tanya.math.nbtheory;
import tanya.meta.trait;
import tanya.meta.transform;
@ -548,9 +547,6 @@ if (isFloatingPoint!F)
/**
* Computes $(D_PARAM x) to the power $(D_PARAM y) modulo $(D_PARAM z).
*
* If $(D_PARAM I) is an $(D_PSYMBOL Integer), the allocator of $(D_PARAM x)
* is used to allocate the result.
*
* Params:
* I = Base type.
* G = Exponent type.
@ -600,41 +596,6 @@ in (z > 0, "Division by zero")
return result;
}
/// ditto
I pow(I)(const auto ref I x, const auto ref I y, const auto ref I z)
if (is(I == Integer))
in (z.length > 0, "Division by zero")
{
size_t i;
auto tmp1 = Integer(x, x.allocator);
auto result = Integer(x.allocator);
if (x.size == 0 && y.size != 0)
{
i = y.size;
}
else
{
result = 1;
}
while (i < y.size)
{
for (uint mask = 0x01; mask != 0x10000000; mask <<= 1)
{
if (y.rep[i] & mask)
{
result *= tmp1;
result %= z;
}
auto tmp2 = tmp1;
tmp1 *= tmp2;
tmp1 %= z;
}
++i;
}
return result;
}
///
@nogc nothrow pure @safe unittest
{
@ -648,32 +609,3 @@ in (z.length > 0, "Division by zero")
assert(pow(0, 0, 5) == 1);
assert(pow(0, 5, 5) == 0);
}
///
@nogc nothrow pure @safe unittest
{
assert(pow(Integer(3), Integer(5), Integer(7)) == 5);
assert(pow(Integer(2), Integer(2), Integer(1)) == 0);
assert(pow(Integer(3), Integer(3), Integer(3)) == 0);
assert(pow(Integer(7), Integer(4), Integer(2)) == 1);
assert(pow(Integer(53), Integer(0), Integer(2)) == 1);
assert(pow(Integer(53), Integer(1), Integer(3)) == 2);
assert(pow(Integer(53), Integer(2), Integer(5)) == 4);
assert(pow(Integer(0), Integer(0), Integer(5)) == 1);
assert(pow(Integer(0), Integer(5), Integer(5)) == 0);
}
deprecated
bool isPseudoprime(ulong x) @nogc nothrow pure @safe
{
return pow(2, x - 1, x) == 1;
}
///
@nogc nothrow pure @safe unittest
{
assert(74623.isPseudoprime);
assert(104729.isPseudoprime);
assert(15485867.isPseudoprime);
assert(!15485868.isPseudoprime);
}