summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2018-04-20 15:15:00 +0200
committerEugen Wissner <belka@caraus.de>2018-04-20 15:15:00 +0200
commit5e40424f7d993043909fd8fc207ba7d24ada22b4 (patch)
tree1f0fa6c2700fb5781123ab9f9f3af150f92e5438
parent964a7af32f709b311ac549808ae331827bdcb480 (diff)
downloadtanya-5e40424f7d993043909fd8fc207ba7d24ada22b4.tar.gz
net.inet: Replace CTFE-pow with pow operator
-rw-r--r--source/tanya/net/inet.d21
1 files changed, 10 insertions, 11 deletions
diff --git a/source/tanya/net/inet.d b/source/tanya/net/inet.d
index 91b8110..5438f6a 100644
--- a/source/tanya/net/inet.d
+++ b/source/tanya/net/inet.d
@@ -14,7 +14,6 @@
*/
module tanya.net.inet;
-import std.math;
import tanya.meta.trait;
import tanya.meta.transform;
import tanya.range.primitive;
@@ -31,7 +30,7 @@ import tanya.range.primitive;
* L = Desired range length.
*/
struct NetworkOrder(uint L)
- if (L > ubyte.sizeof && L <= ulong.sizeof)
+if (L > ubyte.sizeof && L <= ulong.sizeof)
{
static if (L > uint.sizeof)
{
@@ -53,7 +52,7 @@ struct NetworkOrder(uint L)
private StorageType value;
private size_t size = L;
- const pure nothrow @safe @nogc invariant
+ invariant
{
assert(this.size <= L);
}
@@ -69,13 +68,13 @@ struct NetworkOrder(uint L)
* T = Value type.
* value = The value should be represented by this range.
*
- * Precondition: $(D_INLINECODE value <= 2 ^^ (length * 8) - 1).
+ * Precondition: $(D_INLINECODE value <= (2 ^^ (L * 8)) - 1).
*/
- this(T)(const T value)
- if (isUnsigned!T)
+ this(T)(T value)
+ if (isUnsigned!T)
in
{
- assert(value <= pow(2, L * 8) - 1);
+ assert(value <= (2 ^^ (L * 8)) - 1);
}
do
{
@@ -216,10 +215,10 @@ struct NetworkOrder(uint L)
* order.
*/
T toHostOrder(T = size_t, R)(R range)
- if (isInputRange!R
- && !isInfinite!R
- && is(Unqual!(ElementType!R) == ubyte)
- && isUnsigned!T)
+if (isInputRange!R
+ && !isInfinite!R
+ && is(Unqual!(ElementType!R) == ubyte)
+ && isUnsigned!T)
{
T ret;
ushort pos = T.sizeof * 8;