std.digest can't CTFE?
Atila Neves
atila.neves at gmail.com
Sat Jun 2 06:31:37 UTC 2018
On Friday, 1 June 2018 at 20:12:23 UTC, Kagamin wrote:
> On Friday, 1 June 2018 at 10:04:52 UTC, Johannes Pfau wrote:
>> However you want to call it, the algorithms interpret data as
>> numbers which means that the binary representation differs
>> based on endianess. If you want portable results, you can't
>> ignore that fact in the implementation. So even though the
>> algorithms are not dependent on the endianess, the
>> representation of the result is. Therefore standards do
>> usually propose an internal byte order.
>
> Huh? The algorithm packs bytes into integers and does it
> independently of platform. Once integers are formed, the
> arithmetic operations are independent of endianness. It works
> this way even in pure javascript, which is not sensitive to
> endianness.
It's a common programming misconception that endianness matters
much. It's one of those that just won't go away, like "GC
languages are slow" or "C is magically fast". I recommend reading
this:
https://commandcenter.blogspot.com/2012/04/byte-order-fallacy.html
In short, unless you're a compiler writer or implementing a
binary protocol endianness only matters if you cast between
pointers and integers. So... Don't.
Atila
More information about the Digitalmars-d
mailing list