On Sunday, 27 February 2022 at 06:11:28 UTC, Ali Çehreli wrote:
I don't like the name readFrom() yet but that works. :)
It seems very delicious, can stay as read():
```d
auto read(T, Endian E = Endian.bigEndian, R)
(R range) {
import bop = std.bitmanip;
return bop.read!(T, E
On 2/26/22 19:38, Chris Piker wrote:
> But this doesn't work:
> ```d
> import std.bitmanip, std.system;
> ubyte[8192] data;
>
> ushort us = data[4..6].read!(ushort, Endian.bigEndian);
> ```
> The reasons for this are probably old hat for seasoned D programmers by
> this is really confusing for ne
Hi D
I have bit of code that was tripping me up. I need to parse
small fields out of a big binary read, and it looks like some
operations just can't be composed when it comes to
using templates. So this works:
```d
import std.bitmanip, std.system;
ubyte[8192] data;
ubyte[] temp = data[4..6]