summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/tanya/math/nbtheory.d68
-rw-r--r--source/tanya/net/iface.d72
2 files changed, 17 insertions, 123 deletions
diff --git a/source/tanya/math/nbtheory.d b/source/tanya/math/nbtheory.d
index 3515705..25c4517 100644
--- a/source/tanya/math/nbtheory.d
+++ b/source/tanya/math/nbtheory.d
@@ -17,21 +17,8 @@ module tanya.math.nbtheory;
import tanya.meta.trait;
import tanya.meta.transform;
-version (TanyaNative)
-{
- private extern float fabs(float) @nogc nothrow pure @safe;
- private extern double fabs(double) @nogc nothrow pure @safe;
- private extern real fabs(real) @nogc nothrow pure @safe;
-
- private extern double log(double) @nogc nothrow pure @safe;
- private extern float logf(float) @nogc nothrow pure @safe;
- private extern real logl(real) @nogc nothrow pure @safe;
-}
-else
-{
- import core.math : fabs;
- import std.math : log;
-}
+import core.math : fabs;
+import std.math : log;
/**
* Calculates the absolute value of a number.
@@ -90,46 +77,19 @@ if (isFloatingPoint!T)
static assert(is(typeof(r.abs) == real));
}
-version (D_Ddoc)
-{
- /**
- * Calculates natural logarithm of $(D_PARAM x).
- *
- * Params:
- * T = Argument type.
- * x = Argument.
- *
- * Returns: Natural logarithm of $(D_PARAM x).
- */
- Unqual!T ln(T)(T x)
- if (isFloatingPoint!T);
-}
-else version (TanyaNative)
-{
- Unqual!T ln(T)(T x) @nogc nothrow pure @safe
- if (isFloatingPoint!T)
- {
- static if (is(Unqual!T == float))
- {
- return logf(x);
- }
- else static if (is(Unqual!T == double))
- {
- return log(x);
- }
- else
- {
- return logl(x);
- }
- }
-}
-else
+/**
+ * Calculates natural logarithm of $(D_PARAM x).
+ *
+ * Params:
+ * T = Argument type.
+ * x = Argument.
+ *
+ * Returns: Natural logarithm of $(D_PARAM x).
+ */
+Unqual!T ln(T)(T x)
+if (isFloatingPoint!T)
{
- Unqual!T ln(T)(T x)
- if (isFloatingPoint!T)
- {
- return log(x);
- }
+ return log(x);
}
///
diff --git a/source/tanya/net/iface.d b/source/tanya/net/iface.d
index 681611b..9338745 100644
--- a/source/tanya/net/iface.d
+++ b/source/tanya/net/iface.d
@@ -20,15 +20,7 @@ import tanya.meta.trait;
import tanya.meta.transform;
import tanya.range;
-version (TanyaNative)
-{
- import mir.linux._asm.unistd;
- import tanya.sys.linux.syscall;
- import tanya.sys.posix.ioctl;
- import tanya.sys.posix.net.if_;
- import tanya.sys.posix.socket;
-}
-else version (Windows)
+version (Windows)
{
import tanya.sys.windows.ifdef;
import tanya.sys.windows.iphlpapi;
@@ -52,39 +44,7 @@ else version (Posix)
uint nameToIndex(R)(R name) @trusted
if (isInputRange!R && is(Unqual!(ElementType!R) == char) && hasLength!R)
{
- version (TanyaNative)
- {
- if (name.length >= IF_NAMESIZE)
- {
- return 0;
- }
- ifreq ifreq_ = void;
-
- copy(name, ifreq_.ifr_name[]);
- ifreq_.ifr_name[name.length] = '\0';
-
- auto socket = syscall(AF_INET,
- SOCK_DGRAM | SOCK_CLOEXEC,
- 0,
- NR_socket);
- if (socket <= 0)
- {
- return 0;
- }
- scope (exit)
- {
- syscall(socket, NR_close);
- }
- if (syscall(socket,
- SIOCGIFINDEX,
- cast(ptrdiff_t) &ifreq_,
- NR_ioctl) == 0)
- {
- return ifreq_.ifr_ifindex;
- }
- return 0;
- }
- else version (Windows)
+ version (Windows)
{
if (name.length > IF_MAX_STRING_SIZE)
{
@@ -155,33 +115,7 @@ String indexToName(uint index) @nogc nothrow @trusted
{
import tanya.memory.op : findNullTerminated;
- version (TanyaNative)
- {
- ifreq ifreq_ = void;
- ifreq_.ifr_ifindex = index;
-
- auto socket = syscall(AF_INET,
- SOCK_DGRAM | SOCK_CLOEXEC,
- 0,
- NR_socket);
- if (socket <= 0)
- {
- return String();
- }
- scope (exit)
- {
- syscall(socket, NR_close);
- }
- if (syscall(socket,
- SIOCGIFNAME,
- cast(ptrdiff_t) &ifreq_,
- NR_ioctl) == 0)
- {
- return String(findNullTerminated(ifreq_.ifr_name));
- }
- return String();
- }
- else version (Windows)
+ version (Windows)
{
NET_LUID luid;
if (ConvertInterfaceIndexToLuid(index, &luid) != 0)