Re: [Ilugc] big endian and little endian issues from Solaris to Linux
On Wed, Oct 28, 2009 at 4:19 AM, narendra babu cnarendra_b...@yahoo.com wrote: I have c/C++ code in Solaris/AIX/HP-UX which is for big endian arch . Now i am moving the c/C++ code to Little endian Linux X86 , i would like to know what are issues need to be addressed when moving from big endian to little endian . No direct experience here, but C bitfields might be another thing for you to worry about. OTOH, something stand along might just run. Does this code read/write from the network, assuming some binary format? Does it read binary blobs off the disk? Give details, this is interesting. Roshan Mathews ___ To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with unsubscribe password address in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Re: [Ilugc] big endian and little endian issues from Solaris to Linux
On Wed, Oct 28, 2009 at 12:11 PM, Roshan Mathews rmath...@gmail.com wrote: On Wed, Oct 28, 2009 at 4:19 AM, narendra babu cnarendra_b...@yahoo.com wrote: i would like to know what are issues need to be addressed when moving from big endian to little endian . No direct experience here, but C bitfields might be another thing for you to worry about. OTOH, something stand along might just run. Does this code read/write from the network, assuming some binary format? Does it read binary blobs off the disk? I have faced some issues while porting the DES algorithm from Solaris to some other OS on Intel(I dunno if it was Windows NT or Netware). I was working in Novell then. I had a very interesting and very long winded debug session in which I compared the results of the complex crypto algorithm step by step until I figured out that the issue was with the left shift/right shift/rotate function in the DES round key generation. The way I did that was instructive. I knew a lot about the internal workings of DES since I was deep into crypto at that time. I ran the same program on the target machine and on Solaris and I knew which outputs at which step had to match. So I did not have to follow the code much, my knowledge of the expected output helped. It was a long time ago, so I don't recollect many details but I was not good at coding then. I could still solve the issue due to my grasp of the technology and the big picture. It was a thoroughly interesting problem to solve. Does this satiate your curiosity Rosh? ;) -Girish -- Gayatri Hitech web: http://gayatri-hitech.com SpamCheetah Spam filter: http://spam-cheetah.com ___ To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with unsubscribe password address in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Re: [Ilugc] big endian and little endian issues from Solaris to Linux
On Wed, Oct 28, 2009 at 6:20 PM, Girish Venkatachalam girishvenkatacha...@gmail.com wrote: On Wed, Oct 28, 2009 at 12:11 PM, Roshan Mathews rmath...@gmail.com wrote: OTOH, something stand along might just run. Does this code read/write from the network, assuming some binary format? Does it read binary blobs off the disk? I meant something standalone. Didn't even see that while scanning ... sheesh. It was a thoroughly interesting problem to solve. Does this satiate your curiosity Rosh? ;) Actually I was asking the OP, but since you ask, no, it doesn't. All you've said is that you faced a problem, and you solved it. The devil is in the details. :) Roshan Mathews ___ To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with unsubscribe password address in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
[Ilugc] big endian and little endian issues from Solaris to Linux
Hello , I have c/C++ code in Solaris/AIX/HP-UX which is for big endian arch . Now i am moving the c/C++ code to Little endian Linux X86 , i would like to know what are issues need to be addressed when moving from big endian to little endian . also is left shift and right shit oprs in C/C++ has issues when moving from big endian to little endian or will it simply run in both archs as is without any issues . Many thanks for your time Naren Connect more, do more and share more with Yahoo! India Mail. Learn more. http://in.overview.mail.yahoo.com/ ___ To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with unsubscribe password address in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Re: [Ilugc] big endian and little endian issues from Solaris to Linux
Hi, I have c/C++ code in Solaris/AIX/HP-UX which is for big endian arch . Now i am moving the c/C++ code to Little endian Linux X86 , i would like to know what are issues need to be addressed when moving from big endian to little endian . Not too sure, but recompiling should handle this automatically. Unless of course, there is code that assumes big-endian and optimizes something. Abishek Goda ___ To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with unsubscribe password address in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Re: [Ilugc] big endian and little endian issues from Solaris to Linux
On Wed, Oct 28, 2009 at 4:19 AM, narendra babu cnarendra_b...@yahoo.com wrote: Hello , I have c/C++ code in Solaris/AIX/HP-UX which is for big endian arch . Okay. Now i am moving the c/C++ code to Little endian Linux X86 , Okay. i would like to know what are issues need to be addressed when moving from big endian to little endian . There are a few. Surely left shift and right shift are good examples. There are many others too. The way ntohs() , ntohs(), ntohl(), ntohl() works will be different. Network byte order is big endian. Intel is Little Endian. So you have to work around all that. Also socket communications between a little endian and big endian machine will land you in trouble if you don't take care. It is best to convert both sides to network byte order before communication. Also ensure that you use character buffers and not integers as much as possible. Endianness only affects integers(shorts, signed, unsigned longs) As long as you use byte arrays, you won't have issues. also is left shift and right shit oprs in C/C++ has issues when moving from big endian to little endian or will it simply run in both archs as is without any issues . Best of luck! -Girish -- Gayatri Hitech web: http://gayatri-hitech.com SpamCheetah Spam filter: http://spam-cheetah.com ___ To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with unsubscribe password address in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc
Re: [Ilugc] big endian and little endian issues from Solaris to Linux
On Wed, Oct 28, 2009 at 4:19 AM, narendra babu cnarendra_b...@yahoo.com wrote: i would like to know what are issues need to be addressed when moving from big endian to little endian . If you are reading/writing binary data (int, floats, structs), then you need to ensure the appropriate byte swapping functions are used. libc has several functions for this purpose, as well as several 3rd party libraries are also available. Other than this, I don't think there are any endian issues to be worried about. also is left shift and right shit oprs in C/C++ has issues when moving from big endian to little endian or will it simply run in both archs as is without any issues . Shift operators work as expected on both platforms. Nothing to worry. Ensure byte swapping is done immediately after read(), and just before write() and there should be no problems. You should consider the different sizes of int and long on 64bit and 32bit platforms. Sparc enforces stricter memory alignment than x86, so the size of structs will vary between platforms. Never make assumptions, and always use sizeof() to calculate memory requirements for structs and arrays. - Raja ___ To unsubscribe, email ilugc-requ...@ae.iitm.ac.in with unsubscribe password address in the subject or body of the message. http://www.ae.iitm.ac.in/mailman/listinfo/ilugc