Forum Discussion
Altera_Forum
Honored Contributor
16 years agoLinux with MMU on NEEK
Hi, all. I'm testing Linux MMU version, on my NEEK. http://www.nioswiki.com/linux It works fine and I can use "bash" shell. This is the evident proof that we are using the true 'fo...
Altera_Forum
Honored Contributor
16 years agoHi,
--- Quote Start --- If from->sin_addr is a long (or pointer) type, it can assume it is aligned correctly, Thus the compiled code might be correct. --- Quote End --- Yes, you are right. And I think this source will not consider the machines that can not do unaligned-access. --- Quote Start --- If it is not, I would give memcpy the correct alignment. e.g.: memcpy ((char*)&from -> sin_addr, (char*)&ip -> ip_src, 4); --- Quote End --- Maybe, it's OK. And sorry, I made a mistake for the copy direction.
{ int i;
//unsigned char *pd = &ip -> ip_src, *ps = &from -> sin_addr;
unsigned char *ps = &ip -> ip_src, *pd = &from -> sin_addr;
for (i = 0; i < 4; i++)
*pd++ = *ps++;
}
Kazu