I reported this as a regression
https://issues.dlang.org/show_bug.cgi?id=14582
The std.batmanip bigEndianToNative has a regression where the
slice range doesn't work with variables (only literals).
Is the syntax incorrect or is this a regression in dmd?
Using this main.d:
import std.bitmanip;
int main(string args[])
{
auto datain = new ubyte[16];
// this syntax wor
On Wednesday, 22 October 2014 at 01:08:52 UTC, ketmar via
Digitalmars-d-learn wrote:
the short answer:
uint fromBuf =
bigEndianToNative!uint(cast(ubyte[4])buffer[offset..offset+4]);
ketmar, we meet again! Your explanation is great and that solved
my problem. Thank you. Maybe I'll try out t
I'm trying to create a primitive type given a specific buffer
slice. I can place the uint into a sliced buffer but I'm getting
compiler errors when using a slice to create the uint. Still new
to Dlang and unfamiliar with the template system.
How do I get this working?
import std.bitmanip;
int
On Saturday, 18 October 2014 at 00:53:57 UTC, ketmar via
Digitalmars-d-learn wrote:
On Sat, 18 Oct 2014 00:32:09 +
Lucas Burson via Digitalmars-d-learn
wrote:
Wow, your changes made it much simpler. Thank you for the
suggestions and expertise ketmar :)
On Friday, 17 October 2014 at 17:40:09 UTC, ketmar via
Digitalmars-d-learn wrote:
i developed a habit of making such buffers one byte bigger than
necessary and just setting the last byte to 0 before
converting. this
way it's guaranteed to be 0-terminated.
Perfect, great idea. Below is my ut
On Friday, 17 October 2014 at 15:30:52 UTC, ketmar via
Digitalmars-d-learn wrote:
On Fri, 17 Oct 2014 15:24:21 +
Lucas Burson via Digitalmars-d-learn
wrote:
So given the below buffer would I use fromStringz (is this in
the stdlib?) to cast it from a null-terminated buffer to a
good
On Friday, 17 October 2014 at 08:31:04 UTC, spir via
Digitalmars-d-learn wrote:
On 17/10/14 09:29, thedeemon via Digitalmars-d-learn wrote:
On Friday, 17 October 2014 at 06:29:24 UTC, Lucas Burson wrote:
// This is where things breaks
{
ubyte[] buff = new ubyte[16];
buff[0..ATA_S
When creating a string from a ubyte[], I have an invalid length
and string.strip() doesn't strip off all whitespace. I'm new to
the language. Is this a compiler issue?
import std.string : strip;
import std.stdio : writefln;
int main()
{
const string ATA_STR = " ATA ";
// this works fi