Results 1 to 5 of 5

Thread: [RESOLVED] How is hex 35 01 dec 309?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2002
    Posts
    55

    Resolved [RESOLVED] How is hex 35 01 dec 309?

    Hello,

    I'm probably just being really dumb, but how can hex 35 01 be decimal 309?

    A quick check in Calculator shows hex 35 01 to be 13569, yet when I use a hex editor on a value of "35 01", it shows "35 01 as integer: 309". The actual value I want it to be is 309, so it is correct, but I'm wondering how it reached that answer?

    Any advice would be appreciated - maths certainly isn't my strong point
    Last edited by j2k; Jul 28th, 2006 at 08:36 PM. Reason: Added resolved status

  2. #2
    Member
    Join Date
    Mar 2006
    Posts
    39

    Re: How is hex 35 01 dec 309?

    0x3501 = 13569 as you said, but 309 = 0x0135.

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How is hex 35 01 dec 309?

    Just to clear it up a little..

    Your hex editor is reading the value as "little endian", basically backwards. Instead of 35 01, it is seeing it as 01 35 (=309)

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2002
    Posts
    55

    Re: How is hex 35 01 dec 309?

    Thanks a lot, that makes sense now

  5. #5
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: [RESOLVED] How is hex 35 01 dec 309?

    All intel-based hardware uses little endian storage by default. But when you write numbers on paper it is by definition big endian. Intel does this because its a bit more efficient for the computer to work this way. Some other architectures (RISC for example) use big endian storage which looks a lot more sensible when you hex edit a file.

    Swings and roundabouts really.
    I don't live here any more.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width