comp.lang.ada
 help / color / mirror / Atom feed
  • * Re: GNAT Ada for DOS - Reading Integers Problem
           [not found] <4g2efj$d5d@susscsc1.rdg.ac.uk>
           [not found] ` <tgmDMwoGx.B04@netcom.com>
    @ 1996-02-24  0:00 ` Tore Joergensen
      1 sibling, 0 replies; 9+ messages in thread
    From: Tore Joergensen @ 1996-02-24  0:00 UTC (permalink / raw)
    
    
    William Paul Berriss (strberis) wrote:
    [...snip...]
    : What it does is this:
    : When reading in the peppers.ras file it gets the nymbers form the header BUT
    : instead of 512 it shows (on the screen) 131072, and instead of 24 it shows 
    : something huge like 6291456.  All these 'wrong' numbers can be made from
    : other numbers, e.g. 131072 is 256 times 512.  It should have been 512!
    
    : The image is fine, I can view it on PaintBrush for windows say.
    : Also, if I strip this header of 'huge' numbers and replace it with the
    : numbers 512 ,512, 24, 1 etc then when I read it in again I do get the correct
    : numbers, 512, 512 ,24, 1 etc.  But then, of course? , PaintBrush cannot read
    : in the image. Obviously the numbers look 'funny' to IT !
    [...snip...]
    
    What you have discovered is the little endian vs. big endian problem.
    You can read about it in Ada95-LRM:13.5.3. I'm not sure if gnat supports
    specifying the bit_order attribute or not, but there are simple solutions
    to fix it. One way to do it would be to define a 16 bit unsigned integer
    and use 'A := shift_left(A,8)+shift_right(A,8);' (see LRM:B.2). I guess
    somebody can tell you the best way to do it (if it isn't the above
    solution).
    --
    +-------------------------+-------------------------------------------+
    | Tore B. Joergensen      | e-mail : tore@lis.pitt.edu                |
    | Centre Court Villa      | web    : http://www.pitt.edu/~tojst1      |
    | 5535 Centre Avenue # 6  |                                           |
    | Pgh, PA 15232, USA      | Norwegian MSIS-student at Univ. of Pgh.   |
    +-------------------------+-------------------------------------------+
    
    
    
    
    ^ permalink raw reply	[flat|nested] 9+ messages in thread

  • end of thread, other threads:[~1996-02-24  0:00 UTC | newest]
    
    Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
    -- links below jump to the message on this page --
         [not found] <4g2efj$d5d@susscsc1.rdg.ac.uk>
         [not found] ` <tgmDMwoGx.B04@netcom.com>
    1996-02-20  0:00   ` GNAT Ada for DOS - Reading Integers Problem Dave Haverkamp
    1996-02-20  0:00     ` Norman H. Cohen
    1996-02-21  0:00       ` Robert Dewar
    1996-02-21  0:00         ` Norman H. Cohen
    1996-02-21  0:00           ` Robert Dewar
    1996-02-23  0:00           ` Robert A Duff
    1996-02-23  0:00             ` Robert Dewar
         [not found]         ` <Dn8ItA.B9H@world.std.com>
    1996-02-23  0:00           ` Robert Dewar
    1996-02-24  0:00 ` Tore Joergensen
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox