Re: Read file/stream

2011-03-14 Thread Steven Schveighoffer
On Fri, 11 Mar 2011 17:39:43 -0500, Stewart Gordon wrote: On 11/03/2011 21:51, Steven Schveighoffer wrote: Presumably there's a reason that it's been provided for uint but not ushort or ulong I think things in std.intrinsic are functions that tie directly to CPU features, True, b

Re: Read file/stream

2011-03-14 Thread Regan Heath
On Fri, 11 Mar 2011 22:39:43 -, Stewart Gordon wrote: On 11/03/2011 21:51, Steven Schveighoffer wrote: Presumably there's a reason that it's been provided for uint but not ushort or ulong I think things in std.intrinsic are functions that tie directly to CPU features, True, b

Re: Read file/stream

2011-03-12 Thread nrgyzer
== Auszug aus Stewart Gordon (smjg_1...@yahoo.com)'s Artikel > On 11/03/2011 18:46, Steven Schveighoffer wrote: > > > I am not sure what facilities Phobos provides for reading/writing integers in network > > order (i.e. Big Endian), but I'm sure there's something. > http://www.digitalmars.com/d/1.

Re: Read file/stream

2011-03-11 Thread Jonathan M Davis
On Friday, March 11, 2011 14:39:43 Stewart Gordon wrote: > On 11/03/2011 21:51, Steven Schveighoffer wrote: > > > >> Presumably there's a reason that it's been provided for uint but not > >> ushort or ulong > > > > I think things in std.intrinsic are functions that tie directly to CPU > > fe

Re: Read file/stream

2011-03-11 Thread Stewart Gordon
On 11/03/2011 21:51, Steven Schveighoffer wrote: Presumably there's a reason that it's been provided for uint but not ushort or ulong I think things in std.intrinsic are functions that tie directly to CPU features, True, but... so presumably, the CPU only provides the possibility for

Re: Read file/stream

2011-03-11 Thread Steven Schveighoffer
On Fri, 11 Mar 2011 16:42:59 -0500, Stewart Gordon wrote: On 11/03/2011 19:50, Ali Çehreli wrote: There is also std.intrinsic.bswap Well spotted. I don't tend to look at std.intrinsic much. Presumably there's a reason that it's been provided for uint but not ushort or ulong I th

Re: Read file/stream

2011-03-11 Thread Stewart Gordon
On 11/03/2011 19:50, Ali Çehreli wrote: There is also std.intrinsic.bswap Well spotted. I don't tend to look at std.intrinsic much. Presumably there's a reason that it's been provided for uint but not ushort or ulong Stewart.

Re: Read file/stream

2011-03-11 Thread Ali Çehreli
On 03/11/2011 11:18 AM, Stewart Gordon wrote: On 11/03/2011 18:46, Steven Schveighoffer wrote: I am not sure what facilities Phobos provides for reading/writing integers in network order (i.e. Big Endian), but I'm sure there's something. http://www.digitalmars.com/d/1.0/phobos/std_stream.html

Re: Read file/stream

2011-03-11 Thread Stewart Gordon
On 11/03/2011 18:46, Steven Schveighoffer wrote: I am not sure what facilities Phobos provides for reading/writing integers in network order (i.e. Big Endian), but I'm sure there's something. http://www.digitalmars.com/d/1.0/phobos/std_stream.html EndianStream I haven't experimented with it.

Re: Read file/stream

2011-03-11 Thread Simen kjaeraas
nrgyzer wrote: I'm trying to read a png file and I'm having some trouble with the chunk-size. Each chunk of a png file begins with a 4 byte (unsigned) integer. When I read this 4 byte integer (uint) I get an absolutely incorrect length. My code currently looks like: void main(string args) {

Re: Read file/stream

2011-03-11 Thread Steven Schveighoffer
On Fri, 11 Mar 2011 13:43:19 -0500, nrgyzer wrote: I'm trying to read a png file and I'm having some trouble with the chunk-size. Each chunk of a png file begins with a 4 byte (unsigned) integer. When I read this 4 byte integer (uint) I get an absolutely incorrect length. My code currently look

Read file/stream

2011-03-11 Thread nrgyzer
I'm trying to read a png file and I'm having some trouble with the chunk-size. Each chunk of a png file begins with a 4 byte (unsigned) integer. When I read this 4 byte integer (uint) I get an absolutely incorrect length. My code currently looks like: void main(string args) { File f = new File