bitmanip bigEndianToNative using a buffer slice?

2014-10-21 Thread Lucas Burson via Digitalmars-d-learn
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

Re: bitmanip bigEndianToNative using a buffer slice?

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Wed, 22 Oct 2014 00:45:17 + Lucas Burson via Digitalmars-d-learn wrote: > 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 un

Re: bitmanip bigEndianToNative using a buffer slice?

2014-10-21 Thread Lucas Burson via Digitalmars-d-learn
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

Re: bitmanip bigEndianToNative using a buffer slice?

2014-10-21 Thread ketmar via Digitalmars-d-learn
On Wed, 22 Oct 2014 01:30:48 + Lucas Burson via Digitalmars-d-learn wrote: > ketmar, we meet again! Your explanation is great and that solved > my problem. Thank you. Maybe I'll try out templates next... yep, i remember. i was glad to help you. ;-) signature.asc Description: PGP signature

Re: bitmanip bigEndianToNative using a buffer slice?

2014-10-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, October 22, 2014 00:45:17 Lucas Burson via Digitalmars-d-learn wrote: 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 unfamil