Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions source/geod24/bitblob.d
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ public struct BitBlob (size_t Bits)
assert(hexstr.length == (Width * 2), ErrorMsg);

auto range = hexstr.byChar.map!(std.ascii.toLower!(char));
foreach (size_t idx, chunk; range.map!(fromHex).chunks(2).retro.enumerate)
this.data[idx] = cast(ubyte)((chunk[0] << 4) + chunk[1]);
size_t idx;
foreach (chunk; range.map!(fromHex).chunks(2).retro)
this.data[idx++] = cast(ubyte)((chunk[0] << 4) + chunk[1]);
}

/***************************************************************************
Expand Down Expand Up @@ -351,6 +352,13 @@ unittest
assert(collectException!AssertError(Hash(buff)) !is null);
}

// Make sure the string parsing works at CTFE
unittest
{
static immutable BitBlob!256 CTFEability = BitBlob!256(GenesisBlockHashStr);
static assert(CTFEability[] == GenesisBlockHash);
}

version (unittest)
{
private:
Expand Down