kernel programming - big endian and little endian issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Where the little and big endian conversion functions in kernel are used.
these are defined in following files

http://lxr.linux.no/source/include/linux/byteorder/little_endian.h
http://lxr.linux.no/source/include/linux/byteorder/big_endian.h

Can someone point me the use of these funtions in kernel, and why we
use them, does not the compiler handle the machine specific endian
issues ??

For example, if we write a small program as follows, will it make any
difference if we compile and run it on little or big endian or will
not the compiler create the code accordingly and taking care of this
endian issue.

Prog:
======
#include<stdio.h>
struct abc{
int x;
short a, b;
char c, d, e, f;
};
void main()
{

struct abc xyz
struct abc* y = &xyz;
y->x = 10;
y->a = 20;
y->b = 30;
y->c = 1;
y->d = 2;
y->e = 3;
y->f = 4;
printf("%d %d %d %d\n", y->c, y->d, y->e, y->f);
}


Gaurav
Email: gauravd.chd@xxxxxxxxx
--------------------------------------------
Read my articles at: http://lkdp.blogspot.com
--------------------------------------------
Easy to get air tickets at affordable price,
US to India Air Tickets: www.Ritz-Travel.com
Call at 001-503-848-2299 or mail at info@xxxxxxxxxxxxxxx
--------------------------------------------

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux