Little- och big-endian problem?

Hi!
I'm writing a program which will run on Windows, Mac OS and Linux. The program will be used for opening binary files created by a program in Windows.
Because the files are created in Windows i guess they will be created according to the little-endian system. The program that will open them will read them in to the memory as a byte array.
My question is: will there be a problem to get the right information from these files if I open them on a big-endian system? (There are no magic numbers in the binary file which indicates the used endian system)
Lina

I have to admit that I get the meaning of big/little endian confused.
As JosAH says; Big endian means the big end is first,
NOT that the big value is at the end.And I have to admit that I find that whole big/little-endian jargon quite confusing
too, I mean the most significant byte is stored at the lowest address and we
call it big-endian ... If the number is stored 'backwards' we call it little endian.
In the old days when computers were made of wood and ran on steam, we
used to call it 'low-byte-first' and 'high-byte-first'. Sigh ... those were the days ;-)
kind regards,
Jos

Similar Messages

  • Oracle guids little endian, big endian problem

    hello every one,
    I am having an strange issue. I am developing a .net app against an Oracle DB. Well, when I insert a guid into a raw oracle changes the order of the byte array.
    In VB.net I see (with all the representations of guids, with or without {,- or whatever):
    ac6d5c4f-542e-4fc8-b8b6-f53821811be3
    In Oracle I see (tested with toad and sql tools):
    4F5C6DAC2E54C84FB8B6F53821811BE3
    It goes ok with the rightests numbers but fails the the leftests.
    Any suggestion?

    I have to admit that I get the meaning of big/little endian confused.
    As JosAH says; Big endian means the big end is first,
    NOT that the big value is at the end.And I have to admit that I find that whole big/little-endian jargon quite confusing
    too, I mean the most significant byte is stored at the lowest address and we
    call it big-endian ... If the number is stored 'backwards' we call it little endian.
    In the old days when computers were made of wood and ran on steam, we
    used to call it 'low-byte-first' and 'high-byte-first'. Sigh ... those were the days ;-)
    kind regards,
    Jos

  • How to judge the platform is little or big endian ?

    I have a c code, but anybody has a Java code?
    Thanks.
    #include <stdio.h>
    //little-endian or big-endian
    bool IsLittleEndian()
    int i = 1;
    char* p = (char*)&i;
    return *p;
    int main()
    if(IsLittleEndian())
      printf("LittleEndian\n");
    else
      printf("BigEndian\n");
    return 0;
    }

    http://www.codeproject.com/cpp/endianness.asp
    I got one, but how to translate into Java code.
    Auto detecting the correct Endian format of a data file
    Suppose you are developing a Windows application that imports Nuclear Magnetic Resonance (NMR) spectra. High resolution NMR files are generally recorded in Silicon or Sun Workstations but recently Windows or Linux based spectrometers are emerging as practical substitutes. It turns out that you will need to know in advance the Endian format of the file to parse correctly all the information. Here are some practical guidelines you can follow to decipher the correct Endianness of a data file:
    Typically, the binary file includes a header with the information about the Endian format.
    If the header is not present , you can guess the Endian format if you know the native format of the computer from which the file comes from. For instance, if the file was created in a Sun Workstation, the Endian format will most likely be Big-Endian.
    If none of the above points apply, the Endian format can be determined by trial and error. For example, if after reading the file assuming one format, the spectrum does not make sense, you will know that you have to use the other format.
    If the data points in the file are in floating point format (double), then the _isnan() function can be of some help to determine the Endian format. For example:
    double dValue;
    FILE* fp;
    fread(&nValue, 1, sizeof(double), fp);
    bool bByteSwap = _isnan(dValue) ? true : falseNote that this method does only guarantee that the byte swap operation is required if _isnan() returns a nonzero value (TRUE); if it returns 0 (FALSE), then it is not possible to know the correct Endian format without further information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Big endian problem during readInt.

    What will happen if an int on a big endian platform is written to an socket using java.io.DataOutputStream's writeInt method
    and this int is then read by a little endian platform using java.io.DataInputStream's readInt method?
    coz the byte order is same,as a result the int in two platform will be different??
    How java achieve platform independent in this case?

    this is taken from the API docs
    writeInt
    public final void writeInt(int v)
    throws IOException
    Writes an int to the underlying output stream as four bytes, high byte first. If no exception is thrown, the
    counter written is incremented by 4.
    Specified by:
    writeInt in interface DataOutput
    Parameters:
    v - an int to be written.
    Throws:
    IOException - if an I/O error occurs.
    See Also: FilterOutputStream.out
    The following is taken from the source code:
    public final void writeInt(int v) throws IOException {
            out.write((v >>> 24) & 0xFF);
            out.write((v >>> 16) & 0xFF);
            out.write((v >>>  8) & 0xFF);
            out.write((v >>>  0) & 0xFF);
            incCount(4);
        } it takes the high byte and writes it first (by shifting 24 bits and ANDing with 0xFF) then does the
    same for all other bytes in the int (different shifts of course). You might have noticed that intel processors
    are little endian while the above code assumes that the int is big endian. Thats cos in java its all big
    endian.
    matfud

  • Converting CT database from little to big-endian

    Hi!
    We want to migrate our Oracle CorporateTime 5.4 running under Linux/Intel onto a Solaris/SPARC-machine.
    Anyone knows where to find the tool unil2bendian so we can convert the database? (CT Server Administrator Guide says we have to contact Steltor...)
    Many thanx in advance!

    Bonjour,
    In order to get the utility, please sent an e-mail to [email protected] We will then be able to open an iTar for you in order to provide you with this utility.
    Thank you for your understanding in this matter.
    Manon Delisle

  • What is Little Endian / Big Endian in Sound settings for Apple Intermediate

    Hi.
    In Final Cut Express, I am trying to splice together multiple video clips, combining footage from:
    1) HDV camcorder imported into iMovie 08 as 960 x 540 (the "lower resolution" option from iMovie '08 import), 16-bit @ 48 KHz (Big Endian), 25 FPS
    2) AVI files (DiVX 512 x 384, MP3 at 44.1 KHz, 23.98 FPS)
    3) Canon Camera "movie" files (Apple OpenDML JPEG 640 x 480, 16-bit Little Endian, Mono @ 44.1 KHz, 30 FPS)
    Questions
    1) What is this little endian / big endian thing?
    2) What is the best codec for me to edit in? My targets are NTSC DVD and also a HD version served via iPod connected to HDTV.
    I am not sure what codec to convert everything to, so that I can edit without having to RENDER every time I do something. I tried to export using QuickTime Pro to convert to Apple Intermediate Codec but am not sure about the option for "Little Endian" (I am using an Intel Mac; I assume I do NOT use little endian? Can someone help clarify?)
    Many thanks!!!

    1. They're compression formats. Different codec use different compression schemes.
    2. You should convert your material to QuickTime using the appropriate DV codec and frame rate.
    None of your material is HD. Some of it is low resolution, lower than even DV. There is no good way to make this material HD.

  • Any need for conversation from big endian and little endian?

    Hi,
    I am planning to migrate an Oracle 9i Database on AIX 5.3 to Oracle 11g R2 Windows 2008, and have planned to use transportable tablespace. But prior to that task is the conversation required from big endian and little endian using RMAN?
    Appreciate any suggestions, comments and hints
    Thanks

    Hi,
    Check V$TRANSPORTABLE_PLATFORM, it shows the ending for each supported platform. Given the results on my 11g, I suspect that you'll have to convert the tablespaces...
    SYSTEM@oracle11 SQL>select *
      2   from V$TRANSPORTABLE_PLATFORM
      3  ;
    PLATFORM_ID PLATFORM_NAME                                                                                         ENDIAN_FORMAT
              7 Microsoft Windows IA (32-bit)                                                                         Little
              6 AIX-Based Systems (64-bit)                                                                            Big
              8 Microsoft Windows IA (64-bit)                                                                         Little
             12 Microsoft Windows x86 64-bit                                                                          LittleHtH
    Johan

  • VDI 3.1 Big Endian vs Little Endian: VDI Cluster to Remote mysql server

    Hello,
    We are implementing a Dual Data center VDI environment and with that, will be using VCS to Cluster a remote Mysql instance. My question, if the VDI Cluster is on x86 (Little Endian), can the remote Mysql DB be on Sparc (Big Endian)?
    Thanks,

    The endian matching is only a requirement for the management and data nodes of a MySQL cluster. If you are going to be using a remote MySQL DB, the VDI servers will be connecting to that remote MySQL DB as a client connection, and there is no requirement for clients to match the endian type.
    http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-exclusive-to-cluster.html

  • Big-endian or little-endian

    Hello,
    Is JVM big-endian or little-endian? Or is it platform dependent?
    How does one check this?
    Regards.

    I also saw over the internet that java is big-endian. But when you run this small piece of code,
    class Test {
         public static void main(String[] args) {
              short x = 10;
              byte high = (byte)(x >>> 8);
              byte low = (byte)x;/* cast implies & 0xff */
              System.out.println( "x=" + x + " high=" + high + " low=" + low );
    The output is:
    x=10 high=0 low=10
    This sample code I have taken from "mindprod.com" site only.
    Is storage different from display? Or am I missing something here?
    Regards.

  • From little Endian to big Endian

    Hi guys, Is there a function in LabView 2010 to go from little endian to big endian? I want to change for example 'B0011000' to '001001B0'.

    how about this
    Labview user

  • Little endian & big endian format system

    Hi,
    I have code which works fine for Little endian format system, can somebady please tell how to get data from big endian format system.
    or is sap has setting where i can turn on and than run my code on that system.
    Thanks,
    John.

    hi
    chk this
    OPEN DATASET dset IN LEGACY TEXT MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp]
    Effect
    Data is read or written in a form which is compatible to BINARY MODE in Releases <= 4.6. This addition is primarily used to convert a file into the code page format specified already when it is opened. At runtime, the system uses the format of the system code page of the application server. The system saves the file then again in the code page specified. This procedure is important if data is exchanged between systems using different code pages. For more information, see READ DATASET and TRANSFER.
    Notes
    on BIG ENDIAN, LITTLE ENDIAN
    These additions specify the byte sequence in which to store numbers (ABAP types I, F, and INT2) in the file.
    These additions may only be used in combination with the additions IN LEGACY BINARY MODE and IN LEGACY TEXT MODE. If these are not specified, the system assumes that the byte sequence determined by the hardware of the application server is used in the file.
    If the byte sequence specified differs from that determined by the hardware of the application server, READDATASET and TRANSFER make the corresponding conversions.
    These additions replace the language element TRANSLATE ... NUMBER FORMAT ... which must not be used in Unicode programs.
    on CODE PAGE cp
    This addition specifies the code page which is used to represent texts in the file.
    This addition may only be used in combination with the additions IN LEGACY BINARY MODE and IN LEGACY TEXT MODE. If this addition is not specified, the system uses the code page defined by the text environment current at the time a READ or TRANSFER command is executed (see SET LOCALE LANGUAGE).
    This addition replaces the language element TRANSLATE ... CODE PAGE ... which must not be used in Unicode programs.
    open datset ... IN LEGACY BINARY MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp]
    Effect
    Data is read or written in a form which is compatible to BINARY MODE in Releases <= 4.6. This addition is primarily used to convert a file into the code page format specified already when it is opened. At runtime, the system uses the format of the system code page of the application server. The system saves the file then again in the code page specified. This procedure is important if data is exchanged between systems using different code pages. For more information, see READ DATASET and TRANSFER.

  • Openfirmware Little + Big Endian

    Hello,
    I was reading a article about OpenFirmware (this one in particlular), and it sayed you can use the command-line tool nvram to look and change the properties of OpenFirmware. When I typed in nvram -p, I got this:
    fcode-debug? false
    skip-netboot? false
    prev-lang:kbd en:0
    load-base 0x800000
    logger-base -1
    default-router-ip
    scroll-lock true
    oem-logo
    boot-screen screen
    default-server-ip
    default-gateway-ip
    security-#badlogins 2
    diag-switch? false
    oem-banner
    default-subnet-mask
    output-device screen
    use-generic? false
    logger-size -1
    diag-file ,diags
    screen-#rows 40
    oem-logo? false
    diag-device enet
    default-client-ip
    default-mac-address? false
    little-endian? false
    aapl,tdm-units
    mouse-device mouse
    input-device keyboard
    virt-base -1
    boot-script
    auto-boot? true
    selftest-#megs 0
    boot-args
    real-base -1
    ram-size 0x20000000
    use-nvramrc? false
    real-size -1
    virt-size -1
    boot-file
    console-screen screen
    boot-volume 3
    input-device-1 /ipc
    real-mode? false
    nvramrc
    gmt-offset 0
    security-mode none
    boot-device pci2/ata-6@D/@0:3,\\:tbxi
    output-device-1 /ipc
    pci-probe-mask -1
    oem-banner? false
    screen-#columns 100
    boot-command mac-boot
    What on earth is little endian doing there? I know that little endian means x86 (Intel, AMD, etc.), and big endian means PowerPC (IBM). What would happen if you turned it to true? This video shows you what little & big endian means. (from Apple) I'm kinda interested in this if x86 was there for years.

    I didn't actually say that there had ever been a little-endian PPC processor, just that Apple have maintained little-endian versions of the OS (and associated parts) and therefore it makes sense that there is some low-level support for controlling the way the system works.
    Just as an aside, the PPC chip has support for both models. According to:
    http://developer.apple.com/documentation/Hardware/DeviceManagers/pcisrvcs/pci_cards_drivers/PCIBOOK.250.html
    The PowerPC microprocessor supports a little-endian processing mode, in which addresses are swizzled when they are used to access memory.
    As that note indicates, it's not a full little-endian support as much as a dynamic flipper that can switch big-endian data into little-endian (and vice versa).

  • Can Lincat find big endian and small endian problem?

    Hi, I want to migrate a project from linux to solaris. And I read that lincat can save a lot of time in migration. But when I tried with lincat. I found that what is found is mainly the difference between linux API and solaris API. I use the following
    codes:
    #include <stdio.h>
    #include <stdlib.h>
    int main(int argc, char *argv[])
    int flagVal = 0x01020304;
    char cptr = (char )&flagVal;
    printf("Val is %d\n", *cptr);
    my lincat does not find the big endian and small endian problem. I also wonder whether lincat can find the misaligned problem and "32 bits and 64 bits" problem. Could you please tell me? I didn't find the answer from lincat manual.
    Edited by: baiwd on May 6, 2008 6:03 PM

    Hi Ankit,
    You may use "Cross Platform Transportable Tablespaces" method if the endian format is different between source and target platforms. Please have a look at Oracle's "Platform Migration Using Transportable Tablespaces" document for more information: http://www.oracle.com/au/products/database/maa-wp-11g-platformmigrationtts-129269.pdf
    Please note that "Transportable Database" is a different feature and can only be used to migrate a new database platform that has the same endian format.
    BR,
    Alper Somuncu

  • Is IntelCore processor big-endian or little-endian?

    Hi,
    I need to know if Mac mini's processor is big-endian or little-endian.
    Thanx.

    Little-endian.
    Snippit from What is endianness?:
    "On the Macintosh platform, PowerPC-based Macintosh computers use big endian addressing, while Intel-based Macs use little-endian addressing."

  • Big endian, little endian, and converting to another datatype.

    Hi all,
    I'm working on a sound visualization program. I'm putting the sound into byte arrays, and I then need to convert those bytes into ints to draw onto the screen. This is easy if the soulds are 8-bit, because you don't have the endian issue. How do I take a byte[] and pull ints from it that represent the waveform that the bytes were pulled from? Is it something like this (where soundBytes is the byte[] pulled from a sound file):
    int sampleFirstPart = (int)soundBytes[0];
    int sampleSecondPart = (int)soundBytes[1];
    int putTogether = sampleFirstPart + sampleSecondPart * 128;
    That's just a wild guess, and I'm not really sure what order these things should go in. How do you do it if it's big-endian? What about if it's little-endian? Is there a preference of one over the other? Does the fact that I'm working with wav files make a difference.
    I'm just full of questions, but any ammount of help you can give is very very much appreciated.
    thanks,
    Matt

    int value = soundBytes[x] + (soundBytes[x+1] << 8); // LE
    or
    int value = (soundBytes[x] << 8) + soundBytes[x+1]; // BE
    I think the LE and BE labels are right, but the calculation part is correct for one or the other.
    However, you need to know the format of the file to know if it's one or the other. You can't really tell from the bytes whether it's one or the other. There should, presumably, be some way to know from the audio format header. Either there'd be a flag to incidate which, or it would be assumed one way or the other because it's of format X. I think that wav files would be LE, but don't quote me on that.

Maybe you are looking for