net.inet: Replace CTFE-pow with pow operator

This commit is contained in:
Eugen Wissner 2018-04-20 15:15:00 +02:00
parent 964a7af32f
commit 5e40424f7d

View File

@ -14,7 +14,6 @@
*/ */
module tanya.net.inet; module tanya.net.inet;
import std.math;
import tanya.meta.trait; import tanya.meta.trait;
import tanya.meta.transform; import tanya.meta.transform;
import tanya.range.primitive; import tanya.range.primitive;
@ -53,7 +52,7 @@ struct NetworkOrder(uint L)
private StorageType value; private StorageType value;
private size_t size = L; private size_t size = L;
const pure nothrow @safe @nogc invariant invariant
{ {
assert(this.size <= L); assert(this.size <= L);
} }
@ -69,13 +68,13 @@ struct NetworkOrder(uint L)
* T = Value type. * T = Value type.
* value = The value should be represented by this range. * 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) this(T)(T value)
if (isUnsigned!T) if (isUnsigned!T)
in in
{ {
assert(value <= pow(2, L * 8) - 1); assert(value <= (2 ^^ (L * 8)) - 1);
} }
do do
{ {