Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-23 Thread H. S. Teoh via Digitalmars-d
On Sat, May 23, 2015 at 09:54:35AM +, Kagamin via Digitalmars-d wrote: > On Friday, 22 May 2015 at 21:03:43 UTC, Jonathan M Davis wrote: > >On Friday, 22 May 2015 at 20:21:59 UTC, Kagamin wrote: > >>Hmm, now that I look at it, the declaration of bigEndianToNative is > >>weird: http://dpaste.dzf

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-23 Thread Kagamin via Digitalmars-d
On Friday, 22 May 2015 at 21:03:43 UTC, Jonathan M Davis wrote: On Friday, 22 May 2015 at 20:21:59 UTC, Kagamin wrote: Hmm, now that I look at it, the declaration of bigEndianToNative is weird: http://dpaste.dzfl.pl/6fad7c9ef22d What's weird about it? Why it has a separate n parameter? It ma

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread Rikki Cattermole via Digitalmars-d
On 23/05/2015 7:48 a.m., Jonathan M Davis wrote: On Friday, 22 May 2015 at 19:44:59 UTC, H. S. Teoh wrote: On Fri, May 22, 2015 at 12:39:12PM -0700, H. S. Teoh via Digitalmars-d wrote: [...] face.palm(); head.hang!inShame(); self.crawlBackTo(hole); [...] Truth be told, though, the

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread Jonathan M Davis via Digitalmars-d
On Friday, 22 May 2015 at 20:21:59 UTC, Kagamin wrote: Hmm, now that I look at it, the declaration of bigEndianToNative is weird: http://dpaste.dzfl.pl/6fad7c9ef22d What's weird about it? - Jonathan M Davis

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread Kagamin via Digitalmars-d
Hmm, now that I look at it, the declaration of bigEndianToNative is weird: http://dpaste.dzfl.pl/6fad7c9ef22d

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread Kagamin via Digitalmars-d
On Friday, 22 May 2015 at 19:48:21 UTC, Jonathan M Davis wrote: Well, I'm not sure how we could fix that. Remove filter n == T.sizeof ?

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread Andrei Alexandrescu via Digitalmars-d
On 5/22/15 12:48 PM, Jonathan M Davis wrote: On Friday, 22 May 2015 at 19:44:59 UTC, H. S. Teoh wrote: On Fri, May 22, 2015 at 12:39:12PM -0700, H. S. Teoh via Digitalmars-d wrote: [...] face.palm(); head.hang!inShame(); self.crawlBackTo(hole); [...] Truth be told, though, the err

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread Jonathan M Davis via Digitalmars-d
On Friday, 22 May 2015 at 19:44:59 UTC, H. S. Teoh wrote: On Fri, May 22, 2015 at 12:39:12PM -0700, H. S. Teoh via Digitalmars-d wrote: [...] face.palm(); head.hang!inShame(); self.crawlBackTo(hole); [...] Truth be told, though, the error message was very unhelpful ab

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread H. S. Teoh via Digitalmars-d
On Fri, May 22, 2015 at 12:39:12PM -0700, H. S. Teoh via Digitalmars-d wrote: [...] > face.palm(); > head.hang!inShame(); > self.crawlBackTo(hole); [...] Truth be told, though, the error message was very unhelpful about it. It just says no templates were matched, no indication ab

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread H. S. Teoh via Digitalmars-d
On Fri, May 22, 2015 at 07:21:40PM +, Jonathan M Davis via Digitalmars-d wrote: [...] > Isn't the problem that you're trying to convert to a ushort, and a > ushort is _2_ bytes, not 4? If you sliced it correctly, it would > compile. For instance, this code compiles just fine for me with dmd >

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread Andrei Alexandrescu via Digitalmars-d
On 5/22/15 12:21 PM, Jonathan M Davis wrote: But if I change it to buf[0 .. 4], then it fails to compile. So, the fact that bigEndianToNative is taking a static array is actually catching a bug for you. Profession of undying love for D language in 3, 2, 1, ... :o) -- Andrei

Re: Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread Jonathan M Davis via Digitalmars-d
On Friday, 22 May 2015 at 19:10:41 UTC, H. S. Teoh wrote: In the spirit of forum bickering, ;-) I stumbled upon this D wart today: I'm reading some data from a file into a ubyte[] buffer, and I want to use bigEndianToNative to convert ushort values in the file data into native byte order (what

Boy, std.bitmanip.bigEndianToNative is annoying to use

2015-05-22 Thread H. S. Teoh via Digitalmars-d
In the spirit of forum bickering, ;-) I stumbled upon this D wart today: I'm reading some data from a file into a ubyte[] buffer, and I want to use bigEndianToNative to convert ushort values in the file data into native byte order (whatever the native order might be). Sounds simple, right? Unfortu