Re: [X10-users] Reading binary files

2009-08-12 Thread Igor Peshansky
Jim LaGrone wrote on 08/12/2009 05:43:42 PM: > On Aug 12, 2009, at 10:23 AM, Igor Peshansky wrote: > > > But you could provide your own implementation of Marshal[Double] > > that reads bytes in whatever order you wish. For example: > > > > class LSB { > >public static class MyDoubleMarshal

Re: [X10-users] Reading binary files

2009-08-12 Thread Jim LaGrone
On Aug 12, 2009, at 10:23 AM, Igor Peshansky wrote: > But you could provide your own implementation of Marshal[Double] > that reads bytes in whatever order you wish. For example: > > class LSB { >public static class MyDoubleMarshal implements Marshal[Double] { >public def read(r: Read

Re: [X10-users] Reading binary files

2009-08-12 Thread Igor Peshansky
Jim LaGrone wrote on 08/12/2009 10:55:38 AM: > On Aug 12, 2009, at 12:09 AM, Igor Peshansky wrote: > > > You neglected to mention whether you're using the C++ backend or the > > Java one. > > Java Right. I realized later that close() is broken in the C++ backend. Your code with my proposed f

Re: [X10-users] Reading binary files

2009-08-12 Thread Jim LaGrone
On Aug 12, 2009, at 12:09 AM, Igor Peshansky wrote: > You neglected to mention whether you're using the C++ backend or the > Java > one. Java > Regardless, I think I've found your problem: > >> static def getDouble( reader: FileReader ) : Double throws > IOException { >> val byte0 = r

Re: [X10-users] Reading binary files

2009-08-11 Thread Igor Peshansky
Jim, You neglected to mention whether you're using the C++ backend or the Java one. Regardless, I think I've found your problem: >static def getDouble( reader: FileReader ) : Double throws IOException { > val byte0 = reader.read(); Console.OUT.printf(" %X\t", byte0); ^

[X10-users] Reading binary files

2009-08-11 Thread Jim LaGrone
I am having trouble reading values from a binary file. The file is written in LSB order but X10 assumes MSB order. I have written methods to compensate for this. The methods for shorts, ints, and floats work, but I'm having trouble with the longs and doubles. Here is a test case. Can someone